MultiSubscription

Struct MultiSubscription 

Source
pub struct MultiSubscription { /* private fields */ }

Implementations§

Source§

impl MultiSubscription

Source

pub fn unregistered() -> Self

Examples found in repository?
examples/simple.rs (line 79)
78    fn new() -> Self {
79        let mut multi_sub = MultiSubscription::unregistered();
80        multi_sub.add::<TestMsg0>().add::<TestMsg1>();
81
82        Self { sub: multi_sub }
83    }
Source

pub fn add<M: Message>(&mut self) -> &mut Self

Examples found in repository?
examples/simple.rs (line 80)
78    fn new() -> Self {
79        let mut multi_sub = MultiSubscription::unregistered();
80        multi_sub.add::<TestMsg0>().add::<TestMsg1>();
81
82        Self { sub: multi_sub }
83    }

Trait Implementations§

Source§

impl ErasedSubscription for MultiSubscription

Source§

fn message_broker(&self) -> Option<Arc<dyn MessageBroker>>

Returns a message broker which sends messages to this subscription.
Source§

fn is_registered(&self) -> bool

Returns if the subscription is registered.
Source§

fn is_active(&self) -> bool

Returns if the subscription is active.
Source§

fn register( &mut self, msg_broker: Arc<dyn MessageBroker>, ) -> Result<(), SubscriptionError>

Registers the subscription in the given message broker.
Source§

fn unregister(&mut self) -> Result<(), SubscriptionError>

Unregisters the subscription in the given message broker.
Source§

fn activate(&self) -> Result<(), SubscriptionError>

Activates the subscription if it was deactivated before.
Source§

fn deactivate(&self) -> Result<(), SubscriptionError>

Dectivates the subscription, in other words temporary makes it stop receiving messages.
Source§

fn recv_message(&self) -> Option<Arc<dyn Message>>

Receives one message if there is any.
Source§

fn message_iter(&self) -> MessageIter<'_>

Returns an iterator that will attempt to yield all pending messages.
Source§

fn process_messages<'f>(&self, f: Box<dyn ErasedMessageHandler + 'f>)

Processes all pending messages by calling the given function on each one.

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

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.