pub trait ErasedSubscription: Sealed {
// Required methods
fn message_broker(&self) -> Option<Arc<dyn MessageBroker>>;
fn is_registered(&self) -> bool;
fn is_active(&self) -> bool;
fn register(
&mut self,
msg_broker: Arc<dyn MessageBroker>,
) -> Result<(), SubscriptionError>;
fn unregister(&mut self) -> Result<(), SubscriptionError>;
fn activate(&self) -> Result<(), SubscriptionError>;
fn deactivate(&self) -> Result<(), SubscriptionError>;
fn recv_message(&self) -> Option<Arc<dyn Message>>;
fn message_iter(&self) -> MessageIter<'_> ⓘ;
fn process_messages<'f>(&self, f: Box<dyn ErasedMessageHandler + 'f>);
}Expand description
A Subscription with and erased message type.
Required Methods§
Sourcefn message_broker(&self) -> Option<Arc<dyn MessageBroker>>
fn message_broker(&self) -> Option<Arc<dyn MessageBroker>>
Returns a message broker which sends messages to this subscription.
Sourcefn is_registered(&self) -> bool
fn is_registered(&self) -> bool
Returns if the subscription is registered.
Sourcefn register(
&mut self,
msg_broker: Arc<dyn MessageBroker>,
) -> Result<(), SubscriptionError>
fn register( &mut self, msg_broker: Arc<dyn MessageBroker>, ) -> Result<(), SubscriptionError>
Registers the subscription in the given message broker.
Sourcefn unregister(&mut self) -> Result<(), SubscriptionError>
fn unregister(&mut self) -> Result<(), SubscriptionError>
Unregisters the subscription in the given message broker.
Sourcefn activate(&self) -> Result<(), SubscriptionError>
fn activate(&self) -> Result<(), SubscriptionError>
Activates the subscription if it was deactivated before.
Sourcefn deactivate(&self) -> Result<(), SubscriptionError>
fn deactivate(&self) -> Result<(), SubscriptionError>
Dectivates the subscription, in other words temporary makes it stop receiving messages.
Sourcefn recv_message(&self) -> Option<Arc<dyn Message>>
fn recv_message(&self) -> Option<Arc<dyn Message>>
Receives one message if there is any.
Sourcefn message_iter(&self) -> MessageIter<'_> ⓘ
fn message_iter(&self) -> MessageIter<'_> ⓘ
Returns an iterator that will attempt to yield all pending messages.
Sourcefn process_messages<'f>(&self, f: Box<dyn ErasedMessageHandler + 'f>)
fn process_messages<'f>(&self, f: Box<dyn ErasedMessageHandler + 'f>)
Processes all pending messages by calling the given function on each one.