pub struct Connection { /* private fields */ }Implementations§
Source§impl Connection
impl Connection
Sourcepub fn connect_system() -> Result<Connection, Error>
pub 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.
Sourcepub fn connect_session() -> Result<Connection, Error>
pub fn connect_session() -> Result<Connection, Error>
Connects to the session bus.
The address is specified by the environment variable DBUS_SESSION_BUS_ADDRESS.
Sourcepub fn connect_uds<P: AsRef<Path>>(addr: P) -> Result<Connection, Error>
pub 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.
Sourcepub fn connect_tcp<T: ToSocketAddrs>(addr: T) -> Result<Connection, Error>
pub 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.
Sourcepub fn send(&self, mbuf: Message) -> Result<u32, Error>
pub fn send(&self, mbuf: 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.
Sourcepub fn call_sync(&self, mbuf: Message) -> Result<Option<Vec<Value>>, Error>
pub fn call_sync(&self, mbuf: 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.