Skip to main content

MulticastProvider

Struct MulticastProvider 

Source
pub struct MulticastProvider { /* private fields */ }
Expand description

The multicast provider: the declared group and port, the socket its threads share, and the counters its status reports. Constructed by the manager from the declaration.

Implementations§

Source§

impl MulticastProvider

Source

pub fn new(config: MulticastConfig) -> Self

A provider over its declaration; nothing opens until the manager calls start, so constructing one is free and never touches the network.

Source

pub fn port(&self) -> u16

The port the provider listens and announces on: the declared port, or — when the declaration says 0 — the free one the system chose at the bind, so nothing races between finding a port and taking it. 0 before the provider has started.

use majordomus_cli::mesh::config::MulticastConfig;
use majordomus_cli::mesh::multicast::MulticastProvider;

let provider = MulticastProvider::new(MulticastConfig {
    port: 0,
    ..MulticastConfig::default()
});
assert_eq!(provider.port(), 0, "nothing is bound before the provider starts");

Trait Implementations§

Source§

impl MeshProvider for MulticastProvider

Source§

fn id(&self) -> &'static str

The provider id, stable, snake_case: the word status listings and sighting provenance carry for this mechanism.
Source§

fn start(&mut self, ctx: &ProviderContext) -> Result<(), MeshError>

Start the provider’s threads. An Err marks this provider Failed and starts the others regardless.
Source§

fn status(&self) -> ProviderStatus

The current status: state, the reason or subject, and this provider’s counters.

Auto Trait Implementations§

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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