Fix Rust compile

This commit is contained in:
Andras Schmelczer 2026-03-28 10:59:51 +00:00
parent 9233a4f314
commit 7b9287ca52
5 changed files with 10 additions and 10 deletions

View file

@ -5,7 +5,7 @@ use log::debug;
use serde::{Deserialize, Serialize};
use crate::{
consts::{DEFAULT_LOG_DIRECTORY, DEFAULT_LOG_LEVEL, DEFAULT_LOG_ROTATION_INTERVAL},
consts::{DEFAULT_LOG_DIRECTORY, DEFAULT_LOG_LEVEL, DEFAULT_LOG_ROTATION_INTERVAL, DURATION_ZERO},
utils::log_level::LogLevel,
};
@ -27,7 +27,7 @@ impl LoggingConfig {
!self.log_directory.is_empty(),
"log_directory must not be an empty string"
);
ensure!(self.log_rotation > 0, "log_rotation must be greater than 0");
ensure!(self.log_rotation > DURATION_ZERO, "log_rotation must be greater than 0");
Ok(())
}
}

View file

@ -7,7 +7,7 @@ use crate::consts::{
DEFAULT_ALLOWED_ORIGINS, DEFAULT_BROADCAST_CHANNEL_CAPACITY, DEFAULT_HOST,
DEFAULT_MAX_BODY_SIZE_MB, DEFAULT_MAX_CLIENTS_PER_VAULT, DEFAULT_MAX_PENDING_WS_CONNECTIONS,
DEFAULT_MERGEABLE_FILE_EXTENSIONS, DEFAULT_PORT, DEFAULT_RATE_LIMIT_PER_USER_PER_SECOND,
DEFAULT_RESPONSE_TIMEOUT_SECONDS,
DEFAULT_RESPONSE_TIMEOUT_SECONDS, DURATION_ZERO,
};
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
@ -35,7 +35,7 @@ pub struct ServerConfig {
/// Per-user maximum requests per second (keyed by bearer token).
/// `None` disables rate limiting.
#[serde(default = "DEFAULT_RATE_LIMIT_PER_USER_PER_SECOND")]
#[serde(default = "default_rate_limit_per_user_per_second")]
pub rate_limit_per_user_per_second: Option<u64>,
/// Allowed CORS origins. Default: `["*"]` (allow all).
@ -52,7 +52,7 @@ pub struct ServerConfig {
impl ServerConfig {
pub fn validate(&self) -> Result<()> {
ensure!(
self.response_timeout > 0,
self.response_timeout > DURATION_ZERO,
"response_timeout must be greater than 0"
);
ensure!(
@ -114,7 +114,7 @@ fn default_mergeable_file_extensions() -> Vec<String> {
.collect()
}
fn DEFAULT_RATE_LIMIT_PER_USER_PER_SECOND() -> Option<u64> {
fn default_rate_limit_per_user_per_second() -> Option<u64> {
debug!("Using default rate limit per second: {DEFAULT_RATE_LIMIT_PER_USER_PER_SECOND:?}");
DEFAULT_RATE_LIMIT_PER_USER_PER_SECOND
}