[go: up one dir, main page]

[][src]Struct zbus::raw::Connection

pub struct Connection<S> { /* fields omitted */ }

A low-level representation of a D-Bus connection

This wrapper is agnostic on the actual transport, using the Socket trait to abstract it. It is compatible with sockets both in blocking or non-blocking mode.

This wrapper abstracts away the serialization & buffering considerations of the protocol, and allows interaction base on messages, rather than bytes.

Implementations

impl<S: Socket> Connection<S>[src]

pub fn try_flush(&mut self) -> Result<()>[src]

Attempt to flush the outgoing buffer

This will try to write as many messages as possible from the outgoing buffer into the socket, until an error is encountered.

This method will thus only block if the socket is in blocking mode.

pub fn enqueue_message(&mut self, msg: Message)[src]

Enqueue a message to be sent out to the socket

This method will not write anything to the socket, you need to call try_flush() afterwards so that your message is actually sent out.

pub fn try_receive_message(&mut self) -> Result<Message>[src]

Attempt to read a message from the socket

This methods will read from the socket until either a full D-Bus message is read or an error is encountered.

If the socket is in non-blocking mode, it may read a partial message. In such case it will buffer it internally and try to complete it the next time you call try_receive_message.

pub fn socket(&self) -> &S[src]

Access the underlying socket

This method is intended to provide access to the socket in order to register it to you event loop, for async integration.

You should not try to read or write from it directly, as it may corrupt the internal state of this wrapper.

Trait Implementations

impl<S> Debug for Connection<S>[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for Connection<S> where
    S: RefUnwindSafe

impl<S> Send for Connection<S> where
    S: Send

impl<S> Sync for Connection<S> where
    S: Sync

impl<S> Unpin for Connection<S> where
    S: Unpin

impl<S> UnwindSafe for Connection<S> where
    S: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.