#[non_exhaustive]pub struct NameOwnerChanged {
pub name: String,
pub old_owner: Option<String>,
pub new_owner: Option<String>,
}Expand description
The org.freedesktop.DBus.NameOwnerChanged signal, which the bus emits
when the ownership of a well known name changes.
Register interest with Connection::watch_name, then decode incoming
signals with decode().
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringThe name whose ownership changed.
old_owner: Option<String>The unique name of the previous owner, or None when the name was not
owned before.
new_owner: Option<String>The unique name of the new owner, or None when the name went away.
Implementations§
Source§impl NameOwnerChanged
impl NameOwnerChanged
Sourcepub fn decode(message: &SignalMessage) -> Result<Option<Self>>
pub fn decode(message: &SignalMessage) -> Result<Option<Self>>
Decode a NameOwnerChanged signal.
Returns None when the message is some other signal, so this can be
applied to everything which arrives without inspecting the message
first. The empty owner strings the bus uses for “no owner” are decoded
into None.
§Examples
use tokio_dbus_runtime::{Connection, Incoming, NameOwnerChanged};
let mut c = Connection::session_bus().await?;
c.watch_name("org.kde.StatusNotifierWatcher").await?;
loop {
if let Incoming::Signal(message) = c.next().await? {
if let Some(changed) = NameOwnerChanged::decode(&message)? {
if changed.new_owner.is_some() {
// The watcher is back, register with it again.
}
}
}
}Sourcepub fn rule(name: &str) -> String
pub fn rule(name: &str) -> String
The match rule which selects this signal for name, as passed to
Connection::add_match.
§Examples
use tokio_dbus_runtime::NameOwnerChanged;
assert_eq!(
NameOwnerChanged::rule("org.kde.StatusNotifierWatcher"),
"type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.kde.StatusNotifierWatcher'",
);Trait Implementations§
Source§impl Clone for NameOwnerChanged
impl Clone for NameOwnerChanged
Source§fn clone(&self) -> NameOwnerChanged
fn clone(&self) -> NameOwnerChanged
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NameOwnerChanged
impl Debug for NameOwnerChanged
impl Eq for NameOwnerChanged
Source§impl PartialEq for NameOwnerChanged
impl PartialEq for NameOwnerChanged
impl StructuralPartialEq for NameOwnerChanged
Auto Trait Implementations§
impl Freeze for NameOwnerChanged
impl RefUnwindSafe for NameOwnerChanged
impl Send for NameOwnerChanged
impl Sync for NameOwnerChanged
impl Unpin for NameOwnerChanged
impl UnsafeUnpin for NameOwnerChanged
impl UnwindSafe for NameOwnerChanged
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more