Struct dbus::nonblock::LocalConnection
source · [−]pub struct LocalConnection { /* private fields */ }
Expand description
A connection to D-Bus, thread local + async version
Implementations
sourceimpl LocalConnection
impl LocalConnection
sourcepub fn unique_name(&self) -> BusName<'_>
pub fn unique_name(&self) -> BusName<'_>
Get the connection’s unique name.
It’s usually something like “:1.54”
sourcepub async fn request_name<'a, N: Into<BusName<'a>>>(
&self,
name: N,
allow_replacement: bool,
replace_existing: bool,
do_not_queue: bool
) -> Result<RequestNameReply, Error>
pub async fn request_name<'a, N: Into<BusName<'a>>>(
&self,
name: N,
allow_replacement: bool,
replace_existing: bool,
do_not_queue: bool
) -> Result<RequestNameReply, Error>
Request a name on the D-Bus.
For detailed information on the flags and return values, see the libdbus documentation.
sourcepub async fn release_name<'a, N: Into<BusName<'a>>>(
&self,
name: N
) -> Result<ReleaseNameReply, Error>
pub async fn release_name<'a, N: Into<BusName<'a>>>(
&self,
name: N
) -> Result<ReleaseNameReply, Error>
Release a previously requested name on the D-Bus.
sourcepub async fn add_match(
&self,
match_rule: MatchRule<'static>
) -> Result<MsgMatch, Error>
pub async fn add_match(
&self,
match_rule: MatchRule<'static>
) -> Result<MsgMatch, Error>
Adds a new match to the connection, and sets up a callback when this message arrives.
If multiple MatchRule
s match the same message, then by default only the first will get
the callback. This behaviour can be changed for signal messages by calling
set_signal_match_mode
.
The returned value can be used to remove the match.
sourcepub async fn add_match_no_cb(&self, match_str: &str) -> Result<(), Error>
pub async fn add_match_no_cb(&self, match_str: &str) -> Result<(), Error>
Adds a new match to the connection, without setting up a callback when this message arrives.
sourcepub async fn remove_match_no_cb(&self, match_str: &str) -> Result<(), Error>
pub async fn remove_match_no_cb(&self, match_str: &str) -> Result<(), Error>
Removes a match from the connection, without removing any callbacks.
sourcepub async fn remove_match(&self, id: Token) -> Result<(), Error>
pub async fn remove_match(&self, id: Token) -> Result<(), Error>
Removes a previously added match and callback from the connection.
sourcepub fn set_signal_match_mode(&self, match_all: bool)
pub fn set_signal_match_mode(&self, match_all: bool)
If true, configures the connection to send signal messages to all matching MatchRule
filters added with add_match
rather than just the first one. This comes
with the following gotchas:
- The messages might be duplicated, so the message serial might be lost (this is generally not a problem for signals).
- Panicking inside a match callback might mess with other callbacks, causing them to be permanently dropped.
- Removing other matches from inside a match callback is not supported.
This is false by default, for a newly-created connection.