pub struct MsgMatch(_);
Expand description

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

Configures the match to receive a synchronous callback with only a message parameter.

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
});

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.

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 {}
});

The token retreived can be used in a call to remove_match to stop matching on the data.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.