pub struct SignalEmitter<'s> {
conn: Connection,
path: ObjectPath<'s>,
destination: Option<BusName<'s>>,
}
Expand description
A signal emitter.
For signal emission using the high-level API, you’ll need instances of this type.
See crate::object_server::InterfaceRef::signal_emitter
and crate::interface
documentation for details and examples of this type in use.
Fields§
§conn: Connection
§path: ObjectPath<'s>
§destination: Option<BusName<'s>>
Implementations§
Source§impl<'s> SignalEmitter<'s>
impl<'s> SignalEmitter<'s>
Sourcepub fn new<P>(conn: &Connection, path: P) -> Result<Self>
pub fn new<P>(conn: &Connection, path: P) -> Result<Self>
Create a new signal context for the given connection and object path.
Sourcepub fn from_parts(conn: Connection, path: ObjectPath<'s>) -> Self
pub fn from_parts(conn: Connection, path: ObjectPath<'s>) -> Self
Create a new signal context for the given connection and object path.
Sourcepub async fn emit<'i, 'm, I, M, B>(
&self,
interface: I,
signal_name: M,
body: &B,
) -> Result<()>where
I: TryInto<InterfaceName<'i>>,
I::Error: Into<Error>,
M: TryInto<MemberName<'m>>,
M::Error: Into<Error>,
B: Serialize + DynamicType,
pub async fn emit<'i, 'm, I, M, B>(
&self,
interface: I,
signal_name: M,
body: &B,
) -> Result<()>where
I: TryInto<InterfaceName<'i>>,
I::Error: Into<Error>,
M: TryInto<MemberName<'m>>,
M::Error: Into<Error>,
B: Serialize + DynamicType,
Emit a signal on the given interface with the given signal name and body.
Sourcepub fn set_destination(self, destination: BusName<'s>) -> Self
pub fn set_destination(self, destination: BusName<'s>) -> Self
Set the destination for the signal emission.
Signals are typically broadcasted and thus don’t have a destination. However, there are cases where you need to unicast signals to specific peers. This method allows you to set the destination for the signals emitted with this context.
Sourcepub fn connection(&self) -> &Connection
pub fn connection(&self) -> &Connection
Get a reference to the associated connection.
Sourcepub fn path(&self) -> &ObjectPath<'s>
pub fn path(&self) -> &ObjectPath<'s>
Get a reference to the associated object path.
Sourcepub fn destination(&self) -> Option<&BusName<'s>>
pub fn destination(&self) -> Option<&BusName<'s>>
Get a reference to the associated destination (if any).
Sourcepub fn to_owned(&self) -> SignalEmitter<'static>
pub fn to_owned(&self) -> SignalEmitter<'static>
Create an owned clone of self
.
Sourcepub fn into_owned(self) -> SignalEmitter<'static>
pub fn into_owned(self) -> SignalEmitter<'static>
Convert into an owned clone of self
.
Trait Implementations§
Source§impl<'s> Clone for SignalEmitter<'s>
impl<'s> Clone for SignalEmitter<'s>
Source§fn clone(&self) -> SignalEmitter<'s>
fn clone(&self) -> SignalEmitter<'s>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'s> Debug for SignalEmitter<'s>
impl<'s> Debug for SignalEmitter<'s>
Source§impl ObjectManagerSignals for SignalEmitter<'_>
impl ObjectManagerSignals for SignalEmitter<'_>
Source§fn interfaces_added<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
object_path: ObjectPath<'life1>,
interfaces_and_properties: HashMap<InterfaceName<'life2>, HashMap<&'life3 str, Value<'life4>>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn interfaces_added<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
object_path: ObjectPath<'life1>,
interfaces_and_properties: HashMap<InterfaceName<'life2>, HashMap<&'life3 str, Value<'life4>>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
This signal is emitted when either a new object is added or when an existing object gains
one or more interfaces. The interfaces_and_properties
argument contains a map with the
interfaces and properties (if any) that have been added to the given object path.
Source§fn interfaces_removed<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
object_path: ObjectPath<'life1>,
interfaces: Cow<'life2, [InterfaceName<'life3>]>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn interfaces_removed<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
object_path: ObjectPath<'life1>,
interfaces: Cow<'life2, [InterfaceName<'life3>]>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
This signal is emitted whenever an object is removed or it loses one or more interfaces.
The interfaces
parameters contains a list of the interfaces that were removed.
Source§impl PropertiesSignals for SignalEmitter<'_>
impl PropertiesSignals for SignalEmitter<'_>
Source§fn properties_changed<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
interface_name: InterfaceName<'life1>,
changed_properties: HashMap<&'life2 str, Value<'life3>>,
invalidated_properties: Cow<'life4, [&'life5 str]>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
fn properties_changed<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
interface_name: InterfaceName<'life1>,
changed_properties: HashMap<&'life2 str, Value<'life3>>,
invalidated_properties: Cow<'life4, [&'life5 str]>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Emit the org.freedesktop.DBus.Properties.PropertiesChanged
signal.