[−][src]Struct dbus::nonblock::MsgMatch
A struct used to handle incoming matches
Note: Due to the lack of async destructors, please call Connection.remove_match() in order to properly stop matching (instead of just dropping this struct).
Implementations
impl MsgMatch
[src]
pub fn msg_cb<F: FnMut(Message) -> bool + Send + 'static>(self, f: F) -> Self
[src]
Configures the match to receive a synchronous callback with only a message parameter.
pub fn cb<R: ReadAll, F: FnMut(Message, R) -> bool + Send + 'static>(
self,
f: F
) -> Self
[src]
self,
f: F
) -> Self
Configures the match to receive a synchronous callback with a message parameter and typed message arguments.
Example
let mr = MatchRule::new_signal("com.example.dbustest", "HelloHappened"); let incoming_signal = connection.add_match(mr).await?.cb(|_, (source,): (String,)| { println!("Hello from {} happened on the bus!", source); true });
pub fn msg_stream(self) -> (Self, UnboundedReceiver<Message>)
[src]
Configures the match to receive a stream of messages.
Note: If the receiving end is disconnected and a message is received, the message matching will end but not in a clean fashion. Call remove_match() to stop matching cleanly.
pub fn stream<R: ReadAll + Send + 'static>(
self
) -> (Self, UnboundedReceiver<(Message, R)>)
[src]
self
) -> (Self, UnboundedReceiver<(Message, R)>)
Configures the match to receive a stream of messages, parsed and ready.
Note: If the receiving end is disconnected and a message is received, the message matching will end but not in a clean fashion. Call remove_match() to stop matching cleanly.
Example
let mr = MatchRule::new_signal("com.example.dbustest", "HelloHappened"); let (incoming_signal, stream) = conn.add_match(mr).await?.stream(); let stream = stream.for_each(|(_, (source,)): (_, (String,))| { println!("Hello from {} happened on the bus!", source); async {} });
pub fn token(&self) -> Token
[src]
The token retreived can be used in a call to remove_match to stop matching on the data.
Auto Trait Implementations
impl RefUnwindSafe for MsgMatch
impl Send for MsgMatch
impl Sync for MsgMatch
impl Unpin for MsgMatch
impl UnwindSafe for MsgMatch
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,