[][src]Struct bastion::dispatcher::Dispatcher

pub struct Dispatcher { /* fields omitted */ }

A generic implementation of the Bastion dispatcher

The main idea of the dispatcher is to provide an alternative way to communicate between a group of actors. For example, dispatcher can be used when a developer wants to send a specific message or share a local state between the specific group of registered actors with the usage of a custom dispatcher.


impl Dispatcher[src]

pub fn dispatcher_type(&self) -> DispatcherType[src]

Returns the type of the dispatcher.

pub fn handler(&self) -> &(dyn DispatcherHandler + Send + Sync + 'static)[src]

Returns the used handler by the dispatcher.

pub fn with_dispatcher_type(self, dispatcher_type: DispatcherType) -> Self[src]

Sets the dispatcher type.

pub fn with_type(dispatcher_type: DispatcherType) -> Self[src]

Creates a dispatcher with a specific dispatcher type.

pub fn with_handler(
    handler: Box<dyn DispatcherHandler + Send + Sync + 'static>
) -> Self

Sets the handler for the dispatcher.

pub fn notify(&self, from_child: &ChildRef, notification_type: NotificationType)[src]

Forwards the message to the handler for processing.

pub fn broadcast_message(&self, message: &Arc<SignedMessage>)[src]

Sends the message to the group of actors. The logic of who and how should receive the message relies onto the handler implementation.

Trait Implementations

impl Debug for Dispatcher[src]

impl Default for Dispatcher[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> AsAny for T where
    T: Any

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

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

impl<T> From<T> for T[src]

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

impl<T> Message for T where
    T: Any + Send + Sync + Debug

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> State for T where
    T: Send + Sync + 'static, 

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,