[][src]Struct tokio::net::UnixStream

pub struct UnixStream { /* fields omitted */ }
This is supported on feature="uds" only.

A structure representing a connected Unix socket.

This socket can be connected directly with UnixStream::connect or accepted from a listener with UnixListener::incoming. Additionally, a pair of anonymous Unix sockets can be created with UnixStream::pair.

Methods

impl UnixStream[src]

pub async fn connect<P>(path: P) -> Result<UnixStream> where
    P: AsRef<Path>, 
[src]

This is supported on feature="uds" only.

Connects to the socket named by path.

This function will create a new Unix socket and connect to the path specified, associating the returned stream with the default event loop's handle.

pub fn from_std(stream: UnixStream) -> Result<UnixStream>[src]

This is supported on feature="uds" only.

Consumes a UnixStream in the standard library and returns a nonblocking UnixStream from this crate.

The returned stream will be associated with the given event loop specified by handle and is ready to perform I/O.

pub fn pair() -> Result<(UnixStream, UnixStream)>[src]

This is supported on feature="uds" only.

Creates an unnamed pair of connected sockets.

This function will create a pair of interconnected Unix sockets for communicating back and forth between one another. Each socket will be associated with the default event loop's handle.

pub fn local_addr(&self) -> Result<SocketAddr>[src]

This is supported on feature="uds" only.

Returns the socket address of the local half of this connection.

pub fn peer_addr(&self) -> Result<SocketAddr>[src]

This is supported on feature="uds" only.

Returns the socket address of the remote half of this connection.

pub fn peer_cred(&self) -> Result<UCred>[src]

This is supported on feature="uds" only.

Returns effective credentials of the process which called connect or pair.

pub fn take_error(&self) -> Result<Option<Error>>[src]

This is supported on feature="uds" only.

Returns the value of the SO_ERROR option.

pub fn shutdown(&self, how: Shutdown) -> Result<()>[src]

This is supported on feature="uds" only.

Shuts down the read, write, or both halves of this connection.

This function will cause all pending and future I/O calls on the specified portions to immediately return with an appropriate value (see the documentation of Shutdown).

pub fn split(&mut self) -> (ReadHalf, WriteHalf)[src]

This is supported on feature="uds" only.

Split a UnixStream into a read half and a write half, which can be used to read and write the stream concurrently.

See the module level documenation of split for more details.

Trait Implementations

impl AsRawFd for UnixStream[src]

impl<'_> AsRef<UnixStream> for ReadHalf<'_>[src]

impl<'_> AsRef<UnixStream> for WriteHalf<'_>[src]

impl AsyncRead for UnixStream[src]

impl AsyncWrite for UnixStream[src]

impl Debug for UnixStream[src]

impl TryFrom<UnixStream> for UnixStream[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(value: UnixStream) -> Result<Self, Self::Error>[src]

Consumes value, returning the mio I/O object.

See PollEvented::into_inner for more details about resource deregistration that happens during the call.

impl TryFrom<UnixStream> for UnixStream[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(stream: UnixStream) -> Result<Self>[src]

Consumes stream, returning the tokio I/O object.

This is equivalent to UnixStream::from_std(stream).

Auto Trait Implementations

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.