pub struct ServerBuilder { /* private fields */ }Expand description
Builder for creating server directives programmatically.
Provides a type-safe, chainable API for constructing DirectiveKind::Server values
with all supported options. Every option is validated at call time via the bounded
integer newtypes from crate::values.
§Examples
use chrony_confile::builder::ServerBuilder;
use chrony_confile::values::{PollInterval, UdpPort};
let directive = ServerBuilder::new("ntp.example.com")
.iburst()
.prefer()
.minpoll(PollInterval::new(4)?)
.maxpoll(PollInterval::new(10)?)
.build();
assert_eq!(directive.kind.name(), "server");Implementations§
Source§impl ServerBuilder
impl ServerBuilder
Sourcepub fn new(hostname: impl Into<String>) -> Self
pub fn new(hostname: impl Into<String>) -> Self
Creates a new builder for the given hostname.
All other options are initialized to chrony defaults.
Sourcepub fn minpoll(self, poll: PollInterval) -> Self
pub fn minpoll(self, poll: PollInterval) -> Self
Sets the minimum polling interval (as a power of 2 in seconds).
Sourcepub fn maxpoll(self, poll: PollInterval) -> Self
pub fn maxpoll(self, poll: PollInterval) -> Self
Sets the maximum polling interval (as a power of 2 in seconds).
Sourcepub fn maxdelay(self, delay: f64) -> Self
pub fn maxdelay(self, delay: f64) -> Self
Sets the maximum expected round-trip delay (seconds).
Sourcepub fn maxdelayratio(self, ratio: f64) -> Self
pub fn maxdelayratio(self, ratio: f64) -> Self
Max delay ratio.
Sourcepub fn maxdelaydevratio(self, ratio: f64) -> Self
pub fn maxdelaydevratio(self, ratio: f64) -> Self
Max delay dev ratio.
Sourcepub fn maxdelayquant(self, quant: f64) -> Self
pub fn maxdelayquant(self, quant: f64) -> Self
Max delay quantile.
Sourcepub fn auto_offline(self) -> Self
pub fn auto_offline(self) -> Self
Auto offline mode.
Sourcepub fn presend(self, poll: PollInterval) -> Self
pub fn presend(self, poll: PollInterval) -> Self
Presend poll interval.
Sourcepub fn family(self, family: AddressFamily) -> Self
pub fn family(self, family: AddressFamily) -> Self
Address family.
Sourcepub fn version(self, version: NtpVersion) -> Self
pub fn version(self, version: NtpVersion) -> Self
Sets the NTP protocol version for this source.
Sourcepub fn minsamples(self, n: u32) -> Self
pub fn minsamples(self, n: u32) -> Self
Sets the minimum number of samples to keep.
Sourcepub fn maxsamples(self, n: u32) -> Self
pub fn maxsamples(self, n: u32) -> Self
Sets the maximum number of samples to keep.
Sourcepub fn polltarget(self, target: PollTarget) -> Self
pub fn polltarget(self, target: PollTarget) -> Self
Sets the poll target number of samples.
Sourcepub fn minstratum(self, stratum: Stratum) -> Self
pub fn minstratum(self, stratum: Stratum) -> Self
Sets the minimum stratum for this source.
Trait Implementations§
Source§impl Clone for ServerBuilder
impl Clone for ServerBuilder
Source§fn clone(&self) -> ServerBuilder
fn clone(&self) -> ServerBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more