logo

Struct zbus::blocking::Connection[][src]

pub struct Connection { /* fields omitted */ }
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

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.