Struct zbus::SignalReceiver
source · [−]pub struct SignalReceiver<'r, 'p> { /* private fields */ }
Expand description
Receives signals for Proxy
instances.
Use this to receive signals on a given connection for a bunch of proxies at the same time.
Implementations
sourceimpl<'r, 'p> SignalReceiver<'r, 'p>
impl<'r, 'p> SignalReceiver<'r, 'p>
sourcepub fn new(conn: Connection) -> Self
pub fn new(conn: Connection) -> Self
Create a new SignalReceiver
instance.
sourcepub fn connection(&self) -> &Connection
pub fn connection(&self) -> &Connection
Get a reference to the associated connection.
sourcepub fn proxies(&self) -> impl Iterator<Item = &&Proxy<'_>>
pub fn proxies(&self) -> impl Iterator<Item = &&Proxy<'_>>
Get a iterator for all the proxies in this receiver.
sourcepub fn receive_for<'a: 'p, 'b: 'r, P>(&mut self, proxy: &'b P) where
P: AsRef<Proxy<'a>>,
pub fn receive_for<'a: 'p, 'b: 'r, P>(&mut self, proxy: &'b P) where
P: AsRef<Proxy<'a>>,
Watch for signals relevant to the proxy
.
Panics
This method will panic if you try to add a proxy with a different associated connection than the one associated with this receiver.
sourcepub fn next_signal(&self) -> Result<Option<Message>>
pub fn next_signal(&self) -> Result<Option<Message>>
Received and handle the next incoming signal on the associated connection.
This method will wait for signal messages on the associated connection and call any
handler registered (through Proxy::connect_signal
) with a proxy in this receiver.
If the signal message was handled by a handler, Ok(None)
is returned. Otherwise, the
received message is returned.
sourcepub fn handle_signal(&self, msg: &Message) -> Result<bool>
pub fn handle_signal(&self, msg: &Message) -> Result<bool>
Handle the provided signal message.
Call any handler registered (through Proxy::connect_signal
) with a proxy in this receiver.
If no errors are encountered, Ok(true)
is returned if a handler was found and called for,
the signal; Ok(false)
otherwise.
Auto Trait Implementations
impl<'r, 'p> RefUnwindSafe for SignalReceiver<'r, 'p>
impl<'r, 'p> Send for SignalReceiver<'r, 'p>
impl<'r, 'p> Sync for SignalReceiver<'r, 'p>
impl<'r, 'p> Unpin for SignalReceiver<'r, 'p> where
'p: 'r,
impl<'r, 'p> UnwindSafe for SignalReceiver<'r, 'p>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more