pub struct DBusSource<Data: 'static> { /* private fields */ }
Expand description
A event source connection to D-Bus, non-async version where callbacks are Send but not Sync.
Implementations§
Source§impl<Data> DBusSource<Data>
impl<Data> DBusSource<Data>
Sourcepub fn new_session() -> Result<(Self, Sender<Message>)>
pub fn new_session() -> Result<(Self, Sender<Message>)>
Create a new connection to the session bus.
Sourcepub fn new_system() -> Result<(Self, Sender<Message>)>
pub fn new_system() -> Result<(Self, Sender<Message>)>
Create a new connection to the system-wide bus.
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”
pub fn with_proxy<'a, 'b, Dest: Into<BusName<'a>>, BusPath: Into<Path<'a>>>( &'b self, dest: Dest, path: BusPath, timeout: Duration, ) -> Proxy<'a, &'b Self>
Sourcepub fn request_name<'a, Name: Into<BusName<'a>>>(
&self,
name: Name,
allow_replacement: bool,
replace_existing: bool,
do_not_queue: bool,
) -> Result<RequestNameReply, Error>
pub fn request_name<'a, Name: Into<BusName<'a>>>( &self, name: Name, 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 fn release_name<'a, Name: Into<BusName<'a>>>(
&self,
name: Name,
) -> Result<ReleaseNameReply, Error>
pub fn release_name<'a, Name: Into<BusName<'a>>>( &self, name: Name, ) -> Result<ReleaseNameReply, Error>
Release a previously requested name on the D-Bus.
Sourcepub fn add_match<Args: ReadAll, Callback>(
&self,
match_rule: MatchRule<'static>,
callback: Callback,
) -> Result<Token, Error>
pub fn add_match<Args: ReadAll, Callback>( &self, match_rule: MatchRule<'static>, callback: Callback, ) -> Result<Token, Error>
Adds a new match to the connection, and sets up a callback when this message arrives.
The returned value can be used to remove the match. The match is also removed if the callback returns “false”.
Sourcepub fn add_match_data<Args: ReadAll, Callback>(
&self,
match_rule: MatchRule<'static>,
callback: Callback,
) -> Result<Token, Error>
pub fn add_match_data<Args: ReadAll, Callback>( &self, match_rule: MatchRule<'static>, callback: Callback, ) -> Result<Token, Error>
Adds a new match to the connection, and sets up a callback when this message arrives. This callback will be able to access the calloop user data.
The returned value can be used to remove the match. The match is also removed if the callback returns “false”.
Sourcepub fn remove_match(&self, id: Token) -> Result<(), Error>
pub fn remove_match(&self, id: Token) -> Result<(), Error>
Removes a previously added match and callback from the connection.
pub fn process(&mut self, timeout: Duration) -> Result<bool, Error>
Sourcepub fn quick_insert(
self,
handle: LoopHandle<Data>,
panic_on_orphan: bool,
) -> Result<Source<DBusSource<Data>>, InsertError<DBusSource<Data>>>
pub fn quick_insert( self, handle: LoopHandle<Data>, panic_on_orphan: bool, ) -> Result<Source<DBusSource<Data>>, InsertError<DBusSource<Data>>>
Insert this source into the given event loop with an adapder that ether panics on orphan events or just logs it at warn level. You probably only what this if you set eavesdrop on a MatchRule.