Trait zbus::connection::socket::Socket

source ·
pub trait Socket {
    type ReadHalf: ReadHalf;
    type WriteHalf: WriteHalf;

    // Required method
    fn split(self) -> Split<Self::ReadHalf, Self::WriteHalf>
       where Self: Sized;
}
Expand description

Trait representing some transport layer over which the DBus protocol can be used

In order to allow simultaneous reading and writing, this trait requires you to split the socket into a read half and a write half. The reader and writer halves can be any types that implement ReadHalf and WriteHalf respectively.

The crate provides implementations for async_io and tokio’s UnixStream wrappers if you enable the corresponding crate features (async_io is enabled by default).

You can implement it manually to integrate with other runtimes or other dbus transports. Feel free to submit pull requests to add support for more runtimes to zbus itself so rust’s orphan rules don’t force the use of a wrapper struct (and to avoid duplicating the work across many projects).

Required Associated Types§

Required Methods§

source

fn split(self) -> Split<Self::ReadHalf, Self::WriteHalf>
where Self: Sized,

Split the socket into a read half and a write half.

Implementations on Foreign Types§

source§

impl Socket for VsockStream

source§

impl Socket for TcpStream

source§

impl Socket for UnixStream

Implementors§