pub struct UnixSocket { /* private fields */ }net only.Expand description
A Unix socket that has not yet been converted to a UnixStream or
UnixListener.
Implementations§
Source§impl UnixSocket
impl UnixSocket
Sourcepub async fn new_stream() -> Result<UnixSocket, Error>
pub async fn new_stream() -> Result<UnixSocket, Error>
Creates a new Unix stream socket.
Sourcepub fn local_addr(&self) -> Result<SockAddr, Error>
pub fn local_addr(&self) -> Result<SockAddr, Error>
Returns the local address that this socket is bound to.
Sourcepub fn take_error(&self) -> Result<Option<Error>, Error>
pub fn take_error(&self) -> Result<Option<Error>, Error>
Returns the value of the SO_ERROR option.
Sourcepub async fn bind(&self, path: impl AsRef<Path>) -> Result<(), Error>
pub async fn bind(&self, path: impl AsRef<Path>) -> Result<(), Error>
Binds the socket to the given address.
Sourcepub async fn bind_addr(&self, addr: &SockAddr) -> Result<(), Error>
pub async fn bind_addr(&self, addr: &SockAddr) -> Result<(), Error>
Binds the socket to the given address.
Sourcepub async fn listen(self, backlog: i32) -> Result<UnixListener, Error>
pub async fn listen(self, backlog: i32) -> Result<UnixListener, Error>
Converts the socket into a UnixListener.
backlog defines the maximum number of pending connections are queued
by the operating system at any given time. Connections are removed from
the queue with UnixListener::accept. When the queue is full, the
operating-system will start rejecting connections.
Sourcepub async fn connect(self, path: impl AsRef<Path>) -> Result<UnixStream, Error>
pub async fn connect(self, path: impl AsRef<Path>) -> Result<UnixStream, Error>
Establishes a Unix connection with a peer at the specified socket address.
See UnixSocket::connect_addr for more details.
Sourcepub async fn connect_addr(self, addr: &SockAddr) -> Result<UnixStream, Error>
pub async fn connect_addr(self, addr: &SockAddr) -> Result<UnixStream, Error>
Establishes a Unix connection with a peer at the specified socket address.
The UnixSocket is consumed. Once the connection is established, a
connected UnixStream is returned. If the connection fails, the
encountered error is returned.
On Windows, the socket should be bound to an empty address before connecting.
Trait Implementations§
Source§impl AsRawSocket for UnixSocket
Available on Windows only.
impl AsRawSocket for UnixSocket
Source§fn as_raw_socket(&self) -> u64
fn as_raw_socket(&self) -> u64
Source§impl AsSocket for UnixSocket
Available on Windows only.
impl AsSocket for UnixSocket
Source§fn as_socket(&self) -> BorrowedSocket<'_>
fn as_socket(&self) -> BorrowedSocket<'_>
Source§impl Debug for UnixSocket
impl Debug for UnixSocket
Source§impl FromRawSocket for UnixSocket
Available on Windows only.
impl FromRawSocket for UnixSocket
Source§unsafe fn from_raw_socket(sock: u64) -> UnixSocket
unsafe fn from_raw_socket(sock: u64) -> UnixSocket
SharedFd.Auto Trait Implementations§
impl Freeze for UnixSocket
impl RefUnwindSafe for UnixSocket
impl Send for UnixSocket
impl Sync for UnixSocket
impl Unpin for UnixSocket
impl UnsafeUnpin for UnixSocket
impl UnwindSafe for UnixSocket
Blanket Implementations§
§impl<T> AsFd for Twhere
T: AsSocket,
impl<T> AsFd for Twhere
T: AsSocket,
§fn as_fd(&self) -> BorrowedSocket<'_>
fn as_fd(&self) -> BorrowedSocket<'_>
as_fd function for Winsock, where an Fd is a Socket.§impl<T> AsRawFd for Twhere
T: AsRawSocket,
impl<T> AsRawFd for Twhere
T: AsRawSocket,
§impl<T> AsRawSocketlike for Twhere
T: AsRawSocket,
impl<T> AsRawSocketlike for Twhere
T: AsRawSocket,
§fn as_raw_socketlike(&self) -> u64
fn as_raw_socketlike(&self) -> u64
§impl<T> AsRawSocketlike for Twhere
T: AsRawSocket,
impl<T> AsRawSocketlike for Twhere
T: AsRawSocket,
§fn as_raw_socketlike(&self) -> u64
fn as_raw_socketlike(&self) -> u64
§impl<T> AsSocketlike for Twhere
T: AsSocket,
impl<T> AsSocketlike for Twhere
T: AsSocket,
§fn as_socketlike(&self) -> BorrowedSocket<'_>
fn as_socketlike(&self) -> BorrowedSocket<'_>
§fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
&Target. Read more§impl<T> AsSocketlike for Twhere
T: AsSocket,
impl<T> AsSocketlike for Twhere
T: AsSocket,
§fn as_socketlike(&self) -> BorrowedSocket<'_>
fn as_socketlike(&self) -> BorrowedSocket<'_>
§fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
&Target. Read moreSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> FromRawFd for Twhere
T: FromRawSocket,
impl<T> FromRawFd for Twhere
T: FromRawSocket,
§unsafe fn from_raw_fd(raw_fd: u64) -> T
unsafe fn from_raw_fd(raw_fd: u64) -> T
from_raw_fd for use with Winsock API. Read more§impl<T> FromRawSocketlike for Twhere
T: FromRawSocket,
impl<T> FromRawSocketlike for Twhere
T: FromRawSocket,
§unsafe fn from_raw_socketlike(raw: u64) -> T
unsafe fn from_raw_socketlike(raw: u64) -> T
Self from the raw value.§impl<T> FromRawSocketlike for Twhere
T: FromRawSocket,
impl<T> FromRawSocketlike for Twhere
T: FromRawSocket,
§unsafe fn from_raw_socketlike(raw: u64) -> T
unsafe fn from_raw_socketlike(raw: u64) -> T
Self from the raw value.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more