pub struct Config {
pub sync_interval_secs: u64,
pub clock_jump_threshold_secs: i64,
pub ntp_servers: Vec<String>,
pub max_retries: usize,
pub socket_timeout_secs: u64,
}Expand description
Configuration for NTP timer
Supports builder pattern for easy customization
Fields§
§sync_interval_secs: u64Background synchronization interval in seconds (default: 600)
clock_jump_threshold_secs: i64Clock jump detection threshold in seconds (default: 5)
ntp_servers: Vec<String>List of NTP servers to query
max_retries: usizeMaximum retry attempts (default: 3)
socket_timeout_secs: u64Socket timeout in seconds (default: 5)
Implementations§
Source§impl Config
impl Config
Sourcepub fn with_sync_interval(self, secs: u64) -> Self
pub fn with_sync_interval(self, secs: u64) -> Self
Sets the background synchronization interval
Sourcepub fn with_jump_threshold(self, secs: i64) -> Self
pub fn with_jump_threshold(self, secs: i64) -> Self
Sets the clock jump detection threshold
Sourcepub fn with_ntp_servers(self, servers: Vec<String>) -> Self
pub fn with_ntp_servers(self, servers: Vec<String>) -> Self
设置 NTP 服务器列表
Sourcepub fn with_max_retries(self, retries: usize) -> Self
pub fn with_max_retries(self, retries: usize) -> Self
设置最大重试次数
Sourcepub fn with_socket_timeout(self, secs: u64) -> Self
pub fn with_socket_timeout(self, secs: u64) -> Self
设置套接字超时
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more