ReflectorConfigBuilder

Struct ReflectorConfigBuilder 

Source
pub struct ReflectorConfigBuilder<Cs, Ms, Bn> { /* private fields */ }
Expand description

Typestate builder for ReflectorConfig.

Parameters:

  • CsMissing or Provided, tracks whether the callsign has been set.
  • Ms — tracks whether the module set has been provided.
  • Bn — tracks whether the bind address has been set.

Self::build is only implemented when all three markers are Provided — forgetting any required field turns .build() into a compile error.

Implementations§

Source§

impl<Cs, Ms, Bn> ReflectorConfigBuilder<Cs, Ms, Bn>

Source

pub fn callsign( self, callsign: Callsign, ) -> ReflectorConfigBuilder<Provided, Ms, Bn>

Set the reflector callsign.

Source

pub fn module_set( self, modules: HashSet<Module>, ) -> ReflectorConfigBuilder<Cs, Provided, Bn>

Set the module set (HashSet<Module> — pass one or more module letters).

Source

pub fn bind(self, bind: SocketAddr) -> ReflectorConfigBuilder<Cs, Ms, Provided>

Set the UDP bind address.

Source

pub const fn max_clients_per_module(self, value: usize) -> Self

Override the maximum clients per module (default 50).

Source

pub const fn max_total_clients(self, value: usize) -> Self

Override the maximum total clients (default 250).

Source

pub fn enable(self, protocol: ProtocolKind) -> Self

Add a protocol to the enabled set.

Source

pub fn disable(self, protocol: ProtocolKind) -> Self

Remove a protocol from the enabled set.

Source

pub const fn keepalive_interval(self, value: Duration) -> Self

Override the keepalive poll interval (default 1s).

Source

pub const fn keepalive_inactivity_timeout(self, value: Duration) -> Self

Override the keepalive inactivity timeout (default 30s).

Source

pub const fn voice_inactivity_timeout(self, value: Duration) -> Self

Override the voice inactivity timeout (default 2s).

Source

pub const fn cross_protocol_forwarding(self, value: bool) -> Self

Enable or disable cross-protocol forwarding (default false).

Source

pub const fn tx_rate_limit_frames_per_sec(self, value: f64) -> Self

Override the per-client TX rate limit in frames per second (default 60.0).

The default is 3× the nominal 20 fps D-STAR voice rate, so legitimate voice streams never hit the limit. Lower it to tighten the DoS envelope; raise it if you expect large bursts of legitimate traffic.

Source§

impl ReflectorConfigBuilder<Provided, Provided, Provided>

Source

pub fn build(self) -> Result<ReflectorConfig, ConfigError>

Finalize the configuration.

§Errors

Returns ConfigError::EmptyModules if the supplied module set was empty. All other required fields are guaranteed non-None by the typestate markers.

Trait Implementations§

Source§

impl<Cs: Debug, Ms: Debug, Bn: Debug> Debug for ReflectorConfigBuilder<Cs, Ms, Bn>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Cs, Ms, Bn> Freeze for ReflectorConfigBuilder<Cs, Ms, Bn>

§

impl<Cs, Ms, Bn> RefUnwindSafe for ReflectorConfigBuilder<Cs, Ms, Bn>

§

impl<Cs, Ms, Bn> Send for ReflectorConfigBuilder<Cs, Ms, Bn>
where Cs: Send, Ms: Send, Bn: Send,

§

impl<Cs, Ms, Bn> Sync for ReflectorConfigBuilder<Cs, Ms, Bn>
where Cs: Sync, Ms: Sync, Bn: Sync,

§

impl<Cs, Ms, Bn> Unpin for ReflectorConfigBuilder<Cs, Ms, Bn>
where Cs: Unpin, Ms: Unpin, Bn: Unpin,

§

impl<Cs, Ms, Bn> UnwindSafe for ReflectorConfigBuilder<Cs, Ms, Bn>
where Cs: UnwindSafe, Ms: UnwindSafe, Bn: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more