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

Listener for Unix seqpacket sockets.

Implementations§

source§

impl UnixSeqpacketListener

source

pub fn bind<P: AsRef<Path>>(address: P) -> Result<Self>

Bind a new seqpacket listener to the given address.

The create listener will be ready to accept new connections.

source

pub fn bind_with_backlog<P: AsRef<Path>>( address: P, backlog: c_int ) -> Result<Self>

Bind a new seqpacket listener to the given address.

The create listener will be ready to accept new connections.

The backlog parameter is used to determine the size of connection queue. See man 3 listen for more information.

source

pub unsafe fn from_raw_fd(fd: RawFd) -> Result<Self>

Wrap a raw file descriptor as UnixSeqpacket.

Registration of the file descriptor with the tokio runtime may fail. For that reason, this function returns a std::io::Result.

Safety

This function is unsafe because the socket assumes it is the sole owner of the file descriptor. Usage of this function could accidentally allow violating this contract which can cause memory unsafety in code that relies on it being true.

source

pub fn as_raw_fd(&self) -> RawFd

Get the raw file descriptor of the socket.

source

pub fn into_raw_fd(self) -> RawFd

Deregister the socket from the tokio runtime and return the inner file descriptor.

source

pub fn local_addr(&self) -> Result<PathBuf>

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

source

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

Get and clear the value of the SO_ERROR option.

source

pub fn poll_accept( &mut self, cx: &mut Context<'_> ) -> Poll<Result<UnixSeqpacket>>

Check if there is a connection ready to accept.

Note that unlike Self::accept, only the last task calling this function will be woken up. For that reason, it is preferable to use the async functions rather than polling functions when possible.

Note that this function does not return a remote address for the accepted connection. This is because connected Unix sockets are anonymous and have no meaningful address.

source

pub async fn accept(&mut self) -> Result<UnixSeqpacket>

Accept a new incoming connection on the listener.

This function is safe to call concurrently from different tasks. Although no order is guaranteed, all calling tasks will try to complete the asynchronous action.

Note that this function does not return a remote address for the accepted connection. This is because connected Unix sockets are anonymous and have no meaningful address.

Trait Implementations§

source§

impl AsFd for UnixSeqpacketListener

source§

fn as_fd(&self) -> BorrowedFd<'_>

Borrows the file descriptor. Read more
source§

impl AsRawFd for UnixSeqpacketListener

source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
source§

impl Debug for UnixSeqpacketListener

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<UnixSeqpacketListener> for OwnedFd

source§

fn from(socket: UnixSeqpacketListener) -> Self

Converts to this type from the input type.
source§

impl IntoRawFd for UnixSeqpacketListener

source§

fn into_raw_fd(self) -> RawFd

Consumes this object, returning the raw underlying file descriptor. Read more
source§

impl TryFrom<OwnedFd> for UnixSeqpacketListener

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(fd: OwnedFd) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.