Struct dbus_bytestream::connection::Connection [-] [+] [src]

pub struct Connection {
    // some fields omitted
}

Methods

impl Connection

fn connect(addr: &str) -> Result<Connection, Error>

Connects to a DBus address string.

fn connect_system() -> Result<Connection, Error>

Connects to the system bus.

The address is specified by the environment variable DBUS_SYSTEM_BUS_ADDRESS or "unix:path=/var/run/dbus/system_bus_socket" if unset.

fn connect_session() -> Result<Connection, Error>

Connects to the session bus.

The address is specified by the environment variable DBUS_SESSION_BUS_ADDRESS.

fn connect_uds<P: AsRef<Path>>(addr: P) -> Result<Connection, Error>

Creates a Connection object using a UNIX domain socket as the transport. The addr is the path to connect to. Abstract paths can be used by passing a NUL byte as the first byte of addr.

fn connect_tcp<T: ToSocketAddrs>(addr: T) -> Result<Connection, Error>

Creates a Connection object using a TCP socket as the transport. The addr is the host and port to connect to.

fn send(&mut self, mbuf: &mut Message) -> Result<u32, Error>

Sends a message over the connection. The Message can be created by one of the functions from the message module, such as message::create_method_call . On success, returns the serial number of the outgoing message so that the reply can be identified.

fn call_sync(&mut self, mbuf: &mut Message) -> Result<Option<Vec<Value>>, Error>

Sends a message over a connection and block until a reply is received. This is only valid for method calls. Returns the sequence of Value objects that is the body of the method return.

Panics

Calling this function with a Message for other than METHOD_CALL or with the NO_REPLY_EXPECTED flag set is a programming error and will panic.

fn read_msg(&mut self) -> Result<Message, Error>

Blocks until a message comes in from the message bus. The received message is returned.