Trait Broadcaster

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

    // Required method
    fn broadcast(
        &mut self,
        recipients: Self::Recipients,
        message: Self::Message,
    ) -> impl Future<Output = Receiver<Self::Response>> + Send;
}
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
Source

type Response: Clone + Send + 'static

The type of data that is returned once the message is broadcasted.

It may also indicate the success or failure of the broadcast attempt.

Required Methods§

Source

fn broadcast( &mut self, recipients: Self::Recipients, message: Self::Message, ) -> impl Future<Output = Receiver<Self::Response>> + Send

Attempt to broadcast a message to the associated recipients.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<P: Array, Dc: Digest, Dd: Digest, M: Committable<Dc> + Digestible<Dd> + Codec> Broadcaster for Mailbox<P, Dc, Dd, M>