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

Low-level connection - handles read/write to the socket

You probably do not need to worry about this as you would typically use the various blocking and non-blocking “Connection” structs instead.

This version avoids dbus_connection_dispatch, and thus avoids callbacks from that function. Instead the same functionality is implemented in the various blocking and non-blocking “Connection” components.

Blocking operations are clearly marked as such, although if you try to access the connection from several threads at the same time, blocking might occur due to an internal mutex inside the dbus library.

Implementations

Creates a new D-Bus connection.

Blocking: until the connection is up and running.

Creates a new D-Bus connection to a remote address.

Note: for all common cases (System / Session bus) you probably want “get_private” instead.

Blocking: until the connection is established.

Registers a new D-Bus connection with the bus.

Note: get_private does this automatically, useful with open_private

Blocking: until a “Hello” response is received from the server.

Gets whether the connection is currently open.

Get the connection’s unique name.

It’s usually something like “:1.54”

Puts a message into libdbus out queue, and tries to send it.

Returns a serial number than can be used to match against a reply.

Note: usually the message is sent when this call happens, but in case internal D-Bus buffers are full, it will be left in the out queue. Call “flush” or “read_write” to retry flushing the out queue.

Sends a message over the D-Bus and waits for a reply. This is used for method calls.

Blocking: until a reply is received or the timeout expires.

Note: In case of an error reply, this is returned as an Err(), not as a Ok(Message) with the error type.

Note: In case pop_message and send_with_reply_and_block is called in parallel from different threads, they might race to retreive the reply message from the internal queue.

Flush the queue of outgoing messages.

Blocking: until the outgoing queue is empty.

Read and write to the connection.

Incoming messages are put in the internal queue, outgoing messages are written.

Blocking: If there are no messages, for up to timeout, or forever if timeout is None. For non-blocking behaviour, set timeout to Some(0).

Gets whether the output message buffer is non-empty

Removes a message from the incoming queue, or returns None if the queue is empty.

Use “read_write” first, so that messages are put into the incoming queue. For unhandled messages, please call MessageDispatcher::default_dispatch to return default replies for method calls.

Removes a message from the incoming queue, or waits until timeout if the queue is empty.

Enables watch tracking, a prequisite for calling watch.

(In theory, this could panic in case libdbus ever changes to listen to something else than one file descriptor, but this should be extremely unlikely to ever happen.)

Gets the file descriptor to listen for read/write.

Panics: if set_watch_enabled is false.

(In theory, this could panic in case libdbus ever changes to listen to something else than one file descriptor, but this should be extremely unlikely to ever happen.)

👎 Deprecated

Get an up-to-date list of file descriptors to watch.

Obsolete - in practice, you can use watch and set_watch_enabled instead.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Sends a message over the D-Bus and blocks, waiting for a reply or a timeout. This is used for method calls. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. 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.

Converts to this type from the input type.

Schedules a message for sending. Read more

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.

Calls U::from(self).

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

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.