pub struct Connection { /* private fields */ }
Expand description

A blocking wrapper of zbus::Connection.

Most of the API is very similar to zbus::Connection, except it’s blocking. One notable difference is that there is no equivalent of Sink implementation provided.

Implementations

Create a Connection to the session/user message bus.

Create a Connection to the system-wide message bus.

Max number of messages to queue.

Set the max number of messages to queue.

The server’s GUID.

The unique name as assigned by the message bus or None if not a message bus connection.

Send msg to the peer.

The connection sets a unique serial number on the message before sending it off.

On successfully sending off msg, the assigned serial number is returned.

Send a method call.

Create a method-call message, send it over the connection, then wait for the reply. Incoming messages are received through receive_message until the matching method reply (error or return) is received.

On successful reply, an Ok(Message) is returned. On error, an Err is returned. D-Bus error replies are returned as MethodError.

Emit a signal.

Create a signal message, and send it over the connection.

Reply to a message.

Given an existing message (likely a method call), send a reply back to the caller with the given body.

Returns the message serial number.

Reply an error to a message.

Given an existing message (likely a method call), send an error reply back to the caller with the given error_name and body.

Returns the message serial number.

Reply to a method call with an error.

Given an existing method call message header, send an error reply back to the caller using one of the standard interface reply types.

Returns the message serial number.

Register a well-known name for this service on the bus.

You can request multiple names for the same ObjectServer. Use Connection::release_name for deregistering names registered through this method.

Note that exclusive ownership without queueing is requested (using crate::fdo::RequestNameFlags::ReplaceExisting and crate::fdo::RequestNameFlags::DoNotQueue flags) since that is the most typical case. If that is not what you want, you should use crate::fdo::DBusProxy::request_name instead (but make sure then that name is requested after you’ve setup your service implementation with the ObjectServer).

Deregister a previously registered well-known name for this service on the bus.

Use this method to deregister a well-known name, registered through Connection::request_name.

Unless an error is encountered, returns Ok(true) if name was previously registered with the bus through self and it has now been successfully deregistered, Ok(false) if name was not previously registered or already deregistered.

Checks if self is a connection to a message bus.

This will return false for p2p connections.

Get a reference to the associated ObjectServer.

The ObjectServer is created on-demand.

Get a reference to the underlying async Connection.

Get the underlying async Connection, consuming self.

Returns a listener, notified on various connection activity.

This function is meant for the caller to implement idle or timeout on inactivity.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more