Struct zbus::fdo::AsyncPeerProxy [−][src]
Asynchronous sibling of PeerProxy.
Proxy for the org.freedesktop.DBus.Peer interface.
Implementations
impl<'c> AsyncPeerProxy<'c>[src]
pub fn new(conn: &Connection) -> Result<Self>[src]
Creates a new proxy with the default service & path.
pub fn new_owned(conn: Connection) -> Result<Self>[src]
Creates a new proxy with the default service & path, taking ownership of conn.
pub fn new_for<E>(
conn: &Connection,
destination: &'c str,
path: impl TryInto<ObjectPath<'c>, Error = E>
) -> Result<Self> where
Error: From<E>, [src]
conn: &Connection,
destination: &'c str,
path: impl TryInto<ObjectPath<'c>, Error = E>
) -> Result<Self> where
Error: From<E>,
Creates a new proxy for the given destination and path.
pub fn new_for_owned<E>(
conn: Connection,
destination: String,
path: impl TryInto<ObjectPath<'static>, Error = E>
) -> Result<Self> where
Error: From<E>, [src]
conn: Connection,
destination: String,
path: impl TryInto<ObjectPath<'static>, Error = E>
) -> Result<Self> where
Error: From<E>,
Same as new_for but takes ownership of the passed arguments.
pub fn new_for_path<E>(
conn: &Connection,
path: impl TryInto<ObjectPath<'c>, Error = E>
) -> Result<Self> where
Error: From<E>, [src]
conn: &Connection,
path: impl TryInto<ObjectPath<'c>, Error = E>
) -> Result<Self> where
Error: From<E>,
Creates a new proxy for the given path.
pub fn new_for_owned_path<E>(
conn: Connection,
path: impl TryInto<ObjectPath<'static>, Error = E>
) -> Result<Self> where
Error: From<E>, [src]
conn: Connection,
path: impl TryInto<ObjectPath<'static>, Error = E>
) -> Result<Self> where
Error: From<E>,
Same as new_for_path but takes ownership of the passed arguments.
pub fn into_inner(self) -> Proxy<'c>[src]
Consumes self, returning the underlying zbus::Proxy.
pub fn inner(&self) -> &Proxy<'_>[src]
The reference to the underlying zbus::Proxy.
pub async fn ping(&self) -> Result<()>[src]
On receipt, an application should do nothing other than reply as usual. It does not matter which object path a ping is sent to.
pub async fn get_machine_id(&self) -> Result<String>[src]
An application should reply the containing a hex-encoded UUID representing the identity of the machine the process is running on. This UUID must be the same for all processes on a single system at least until that system next reboots. It should be the same across reboots if possible, but this is not always possible to implement and is not guaranteed. It does not matter which object path a GetMachineId is sent to.
pub async fn introspect(&self) -> Result<String>[src]
Introspect the associated object, and return the XML description.
Methods from Deref<Target = Proxy<'c>>
pub fn connection(&self) -> &Connection[src]
Get a reference to the associated connection.
pub fn destination(&self) -> &str[src]
Get a reference to the destination service name.
pub fn path(&self) -> &ObjectPath<'_>[src]
Get a reference to the object path.
pub fn interface(&self) -> &str[src]
Get a reference to the interface.
pub async fn introspect(&self) -> Result<String>[src]
Introspect the associated object, and return the XML description.
See the xml module for parsing the result.
pub async fn get_property<T>(&self, property_name: &str) -> Result<T> where
T: TryFrom<OwnedValue>, [src]
T: TryFrom<OwnedValue>,
Get the property property_name.
Effectively, call the Get method of the org.freedesktop.DBus.Properties interface.
pub async fn set_property<'t, T: 't>(
&self,
property_name: &str,
value: T
) -> Result<()> where
T: Into<Value<'t>>, [src]
&self,
property_name: &str,
value: T
) -> Result<()> where
T: Into<Value<'t>>,
Set the property property_name.
Effectively, call the Set method of the org.freedesktop.DBus.Properties interface.
pub async fn call_method<B>(
&self,
method_name: &str,
body: &B
) -> Result<Message> where
B: Serialize + Type, [src]
&self,
method_name: &str,
body: &B
) -> Result<Message> where
B: Serialize + Type,
Call a method and return the reply.
Typically, you would want to use call method instead. Use this method if you need to
deserialize the reply message manually (this way, you can avoid the memory
allocation/copying, by deserializing the reply to an unowned type).
pub async fn call<B, R>(&self, method_name: &str, body: &B) -> Result<R> where
B: Serialize + Type,
R: DeserializeOwned + Type, [src]
B: Serialize + Type,
R: DeserializeOwned + Type,
Call a method and return the reply body.
Use call_method instead if you need to deserialize the reply manually/separately.
pub async fn receive_signal(
&self,
signal_name: &'static str
) -> Result<SignalStream<'a>>[src]
&self,
signal_name: &'static str
) -> Result<SignalStream<'a>>
Create a stream for signal named signal_name.
If the associated connnection is to a bus, a match rule is added for the signal on the bus
so that the bus sends us the signals. Since this match rule needs to be removed when you’re
done with the stream, a synchronous D-Bus method call is made in the destructor of the
stream. If you’d like to avoid this, you must close the stream explicitly, using the
SignalStream::close method.
Errors
Apart from general I/O errors that can result from socket communications, calling this method will also result in an error if the destination service has not yet registered its well-known name with the bus (assuming you’re using the well-known name as destination).
pub async fn connect_signal<H>(
&self,
signal_name: &'static str,
handler: H
) -> Result<SignalHandlerId> where
H: FnMut(&'msg Message) -> BoxFuture<'msg, Result<()>> + Send + 'static, [src]
&self,
signal_name: &'static str,
handler: H
) -> Result<SignalHandlerId> where
H: FnMut(&'msg Message) -> BoxFuture<'msg, Result<()>> + Send + 'static,
Register a handler for signal named signal_name.
Once a handler is successfully registered, call Self::next_signal to wait for the next
signal to arrive and be handled by its registered handler. A unique ID for the handler is
returned, which can be used to deregister this handler using Self::disconnect_signal
method.
Errors
This method can fail if addition of the relevant match rule on the bus fails. You can
safely unwrap the Result if you’re certain that associated connnection is not a bus
connection.
pub async fn disconnect_signal(
&self,
handler_id: SignalHandlerId
) -> Result<bool>[src]
&self,
handler_id: SignalHandlerId
) -> Result<bool>
Deregister the signal handler with the ID handler_id.
This method returns Ok(true) if a handler with the id handler_id is found and removed;
Ok(false) otherwise.
Errors
This method can fail if removal of the relevant match rule on the bus fails. You can
safely unwrap the Result if you’re certain that associated connnection is not a bus
connection.
pub async fn next_signal(&self) -> Result<Option<Message>>[src]
Receive and handle the next incoming signal on the associated connection.
This method will wait for signal messages on the associated connection and call any
handlers registered through the Self::connect_signal method.
If the signal message was handled by a handler, Ok(None) is returned. Otherwise, the
received message is returned.
Errors
This method returns the same errors as Self::receive_signal.
pub async fn handle_signal(&self, msg: &Message) -> Result<bool>[src]
Handle the provided signal message.
Call any handlers registered through the Self::connect_signal method for the provided
signal message.
If no errors are encountered, Ok(true) is returned if any handlers where found and called for,
the signal; Ok(false) otherwise.
Trait Implementations
impl<'c> AsMut<Proxy<'c>> for AsyncPeerProxy<'c>[src]
impl<'c> AsRef<Proxy<'c>> for AsyncPeerProxy<'c>[src]
impl<'c> Debug for AsyncPeerProxy<'c>[src]
impl<'c> Deref for AsyncPeerProxy<'c>[src]
type Target = Proxy<'c>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target[src]
impl<'c> DerefMut for AsyncPeerProxy<'c>[src]
impl<'c> Serialize for AsyncPeerProxy<'c>[src]
impl<'c> Type for AsyncPeerProxy<'c>[src]
Auto Trait Implementations
impl<'c> !RefUnwindSafe for AsyncPeerProxy<'c>
impl<'c> Send for AsyncPeerProxy<'c>
impl<'c> Sync for AsyncPeerProxy<'c>
impl<'c> Unpin for AsyncPeerProxy<'c>
impl<'c> !UnwindSafe for AsyncPeerProxy<'c>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,