[][src]Struct fd_queue::tokio::UnixListener

pub struct UnixListener { /* fields omitted */ }

A Unix socket which can accept connections from other Unix sockets.

You can accept a new connection by using the accept method. Alternatively UnixListener implements the Stream trait, which allows you to use the listener in places that want a stream. The stream will never return None and will also not yield the peer's SocketAddr structure. Iterating over it is equivalent to calling accept in a loop.

Implementations

impl UnixListener[src]

pub fn bind(path: impl AsRef<Path>) -> Result<UnixListener>[src]

Creates a new UnixListener bound to the specified path.

This function will bind a UnixListener to the specified path and associate it with the default event loop's handler.

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.

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

Returns the local socket address of this listener.

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

Returns the value of the SO_ERROR option.

pub async fn accept<'_>(&'_ mut self) -> Result<(UnixStream, SocketAddr)>[src]

Accepts a new incoming connection on this listener.

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.

Trait Implementations

impl AsRawFd for UnixListener[src]

impl Debug for UnixListener[src]

impl Stream for UnixListener[src]

Produces a continuous stream of accepted connections.

This is the equivalent of calling accept() in a loop. It will never be ready with None.

Panics

Polling the stream 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.

type Item = Result<UnixStream>

Values yielded by the stream.

impl TryFrom<UnixListener> for UnixListener[src]

type Error = Error

The type returned in the event of a conversion error.

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> StreamExt for T where
    T: Stream + ?Sized
[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.

impl<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<S> TryStreamExt for S where
    S: TryStream + ?Sized
[src]