Skip to main content

Broadcaster

Trait Broadcaster 

Source
pub trait Broadcaster:
    Clone
    + Send
    + 'static {
    type Recipients;
    type Message: Codec + Clone + Send + 'static;

    // Required method
    fn broadcast(
        &self,
        recipients: Self::Recipients,
        message: Self::Message,
    ) -> Feedback;
}
Expand description

Broadcaster is the interface responsible for attempting replication of messages across a network.

Required Associated Types§

Source

type Recipients

The type of recipients that can receive messages.

Source

type Message: Codec + Clone + Send + 'static

Message is the type of data that can be broadcasted.

It must implement the Codec trait so that it can be:

  • serialized upon broadcast
  • deserialized upon reception

Required Methods§

Source

fn broadcast( &self, recipients: Self::Recipients, message: Self::Message, ) -> Feedback

Attempt to broadcast a message to the associated recipients.

Feedback indicates whether the local broadcast request was accepted for processing. It does not indicate whether recipients received the message.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§