pub struct SignalEmitter<'s> { /* private fields */ }
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.
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 more