Trait sc_utils::pubsub::Dispatch

source ·
pub trait Dispatch<M> {
    type Item;
    type Ret;

    // Required method
    fn dispatch<F>(&mut self, message: M, dispatch: F) -> Self::Ret
       where F: FnMut(&SeqID, Self::Item);
}
Expand description

Dispatch a message of type M.

Required Associated Types§

source

type Item

The type of the that shall be sent through the channel as a result of such dispatch.

source

type Ret

The type returned by the dispatch-method.

Required Methods§

source

fn dispatch<F>(&mut self, message: M, dispatch: F) -> Self::Retwhere F: FnMut(&SeqID, Self::Item),

Dispatch the message of type M.

The implementation is given an instance of M and is supposed to invoke dispatch for each matching subscriber, with an argument of type Self::Item matching that subscriber.

Note that this does not have to be of the same type with the item that will be sent through to the subscribers. The subscribers will receive a message of type Self::Item.

Implementors§