pub struct UnixStream { /* private fields */ }
Expand description

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.

Implementations

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.

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.

Panics

This function panics if thread-local runtime is not set.

The runtime is usually set implicitly when this function is called from a future driven by a tokio runtime, otherwise runtime can be set explicitly with Handle::enter function.

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.

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

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

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

Returns the value of the SO_ERROR option.

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).

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

This method is more efficient than into_split, but the halves cannot be moved into independently spawned tasks.

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

Unlike split, the owned halves can be moved to separate tasks, however this comes at the cost of a heap allocation.

Note: Dropping the write half will shut down the write half of the stream. This is equivalent to calling shutdown(Write) on the UnixStream.

Trait Implementations

Extracts the raw file descriptor. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Prepares an uninitialized buffer to be safe to pass to read. Returns true if the supplied buffer was zeroed out. Read more

Attempts to read from the AsyncRead into buf. Read more

Pulls some bytes from this source into the specified BufMut, returning how many bytes were read. Read more

Attempt to write bytes from buf into the object. Read more

Attempts to flush the object, ensuring that any buffered data reach their destination. Read more

Initiates or attempts to shut down this writer, returning success when the I/O connection has completely shut down. Read more

Writes a Buf into this value, returning how many bytes were written. Read more

Formats the value using the given formatter. Read more

Consumes value, returning the mio I/O object.

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

The type returned in the event of a conversion error.

Consumes stream, returning the tokio I/O object.

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

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.