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

@ -70,7 +70,6 @@ pub struct WebSocketVaultUpdate {
pub enum WebSocketClientMessage {
Handshake(WebSocketHandshake),
CursorPositions(CursorPositionFromClient),
Ping {},
}
#[derive(TS, Serialize, Clone, Debug)]

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
}

View file

@ -2,6 +2,8 @@ use std::time::Duration;
use crate::utils::log_level::LogLevel;
pub const DURATION_ZERO: Duration = Duration::from_secs(0);
pub const DEFAULT_CONFIG_PATH: &str = "config.yml";
pub const DEFAULT_DATABASES_DIRECTORY_PATH: &str = "databases";

View file

@ -5,7 +5,6 @@ use axum::{
};
use axum_extra::TypedHeader;
use axum_typed_multipart::TypedMultipart;
use futures::io::Write;
use log::{debug, info};
use reconcile_text::{BuiltinTokenizer, EditedText, reconcile};
use serde::Deserialize;
@ -56,7 +55,7 @@ pub async fn update_binary(
get_parent_document(&state, &vault_id, &document_id, request.parent_version_id).await?;
let content = request.content.contents.to_vec();
let mut transaction = state
let transaction = state
.database
.create_write_transaction(&vault_id)
.await
@ -102,7 +101,7 @@ pub async fn update_text(
let content = edited_text.apply().text().into_bytes();
let mut transaction = state
let transaction = state
.database
.create_write_transaction(&vault_id)
.await