Enum dazeus::Connection [] [src]

pub enum Connection {
    Unix(UnixStream),
    Tcp(TcpStream),
}

A connection enum that encapsulates TCP and Unix sockets.

This enum is mainly used by the connection_from_str method. If you want to provide your own connection not retrieved from that function, DaZeus will work with any structure that implements the std::io::Read and std::io::Write traits.

Variants

Unix

A Unix domain socket, as implemented by the unix_socket crate.

Tcp

A TCP stream, as implemented by std::net::TcpStream.

Methods

impl Connection

fn try_clone(&self) -> Result<Connection>

Try to duplicate the stream into two objects that reference the same underlying resource.

fn from_str(connection_str: &str) -> Result<Connection>

Takes a string in the format type:connection_str and tries to connect to that location. Returns the connection inside an enum that can be used inside DaZeus directly.

Trait Implementations

impl Read for Connection

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

fn by_ref(&mut self) -> &mut Self

fn bytes(self) -> Bytes<Self>

fn chars(self) -> Chars<Self>

fn chain<R>(self, next: R) -> Chain<Self, R> where R: Read

fn take(self, limit: u64) -> Take<Self>

fn tee<W>(self, out: W) -> Tee<Self, W> where W: Write

impl Write for Connection

fn write(&mut self, buf: &[u8]) -> Result<usize>

fn flush(&mut self) -> Result<()>

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>

fn by_ref(&mut self) -> &mut Self

fn broadcast<W>(self, other: W) -> Broadcast<Self, W> where W: Write