[−][src]Struct ripb::Subscriber
A subscriber to a Bus
.
Subscribers are created with the method [Bus.create_subscriber
]
Register new callbacks with the [on_message
] method, callback will live until the subscriber
is dropped. If you need more control on callback lifecycle use [on_message_with_token
] that
will give you a SubscriptionToken
you can use to [unsubscribe
] a callback.
Methods
impl Subscriber
[src]
pub fn on_message<F, M>(&self, callback: F) -> Result<(), DeadBusError> where
F: Fn(&M) + Send + 'static,
M: Message + 'static,
[src]
F: Fn(&M) + Send + 'static,
M: Message + 'static,
Register a new callback to be called each time a message of the given type is published on
the bus, callback lives as until the Subscriber
is dropped
pub fn on_message_with_token<F, M>(
&self,
callback: F
) -> Result<SubscriptionToken, DeadBusError> where
F: Fn(&M) + Send + 'static,
M: Message + 'static,
[src]
&self,
callback: F
) -> Result<SubscriptionToken, DeadBusError> where
F: Fn(&M) + Send + 'static,
M: Message + 'static,
Register a new callback to be called each time a message of the given type is published on
the bus, callback lives as until the SubscriptionToken
is dropped, unsubscribe
is
called on it or the Subscriber
is dropped
Trait Implementations
impl Drop for Subscriber
[src]
Auto Trait Implementations
impl Send for Subscriber
impl Sync for Subscriber
Blanket Implementations
impl<T> Message for T where
T: Send + Sync,
[src]
T: Send + Sync,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,