pub enum Socket {
Udp(Box<UdpSocket>),
Tcp(Box<TcpSocket>),
Raw(Box<RawSocket>),
Unix(Box<UnixSocket>),
}Expand description
Network socket abstraction.
Variants§
Udp(Box<UdpSocket>)
UDP socket.
Tcp(Box<TcpSocket>)
TCP socket.
Raw(Box<RawSocket>)
Raw IP socket.
Unix(Box<UnixSocket>)
Unix domain socket.
Trait Implementations§
Source§impl Configurable for Socket
impl Configurable for Socket
Source§fn get_option_inner(
&self,
__enum_dispatch_arg_0: &mut GetSocketOption<'_>,
) -> NetResult<bool>
fn get_option_inner( &self, __enum_dispatch_arg_0: &mut GetSocketOption<'_>, ) -> NetResult<bool>
Get a socket option, returns true if the socket supports the option.
Source§fn set_option_inner(
&self,
__enum_dispatch_arg_0: SetSocketOption<'_>,
) -> NetResult<bool>
fn set_option_inner( &self, __enum_dispatch_arg_0: SetSocketOption<'_>, ) -> NetResult<bool>
Set a socket option, returns true if the socket supports the option.
Source§fn get_option(&self, __enum_dispatch_arg_0: GetSocketOption<'_>) -> NetResult
fn get_option(&self, __enum_dispatch_arg_0: GetSocketOption<'_>) -> NetResult
Get a socket option. Dispatches to Configurable::get_option_inner.
Source§fn set_option(&self, __enum_dispatch_arg_0: SetSocketOption<'_>) -> NetResult
fn set_option(&self, __enum_dispatch_arg_0: SetSocketOption<'_>) -> NetResult
Set a socket option. Dispatches to Configurable::set_option_inner.
Source§impl From<UnixSocket> for Socket
impl From<UnixSocket> for Socket
Source§fn from(socket: UnixSocket) -> Self
fn from(socket: UnixSocket) -> Self
Source§impl SocketOps for Socket
impl SocketOps for Socket
Source§fn bind(&self, __enum_dispatch_arg_0: SocketAddrEx) -> NetResult
fn bind(&self, __enum_dispatch_arg_0: SocketAddrEx) -> NetResult
Binds an unbound socket to the given address and port.
Source§fn start_connect(
&self,
__enum_dispatch_arg_0: SocketAddrEx,
) -> NetResult<ConnectStatus>
fn start_connect( &self, __enum_dispatch_arg_0: SocketAddrEx, ) -> NetResult<ConnectStatus>
Starts a connection without waiting for asynchronous completion.
Source§fn connect_status(&self) -> NetResult<ConnectStatus>
fn connect_status(&self) -> NetResult<ConnectStatus>
Checks a previously started asynchronous connection.
Source§fn listen(&self, __enum_dispatch_arg_0: usize) -> NetResult
fn listen(&self, __enum_dispatch_arg_0: usize) -> NetResult
Starts listening on the bound address and port.
Source§fn is_listening(&self) -> bool
fn is_listening(&self) -> bool
Returns whether this socket currently accepts incoming connections.
Source§fn try_accept(&self) -> NetResult<Socket>
fn try_accept(&self) -> NetResult<Socket>
Attempts to accept one connection without parking the caller.
Source§fn try_send(
&self,
__enum_dispatch_arg_0: impl Read + IoBuf,
__enum_dispatch_arg_1: &mut SendOptions,
) -> NetResult<usize>
fn try_send( &self, __enum_dispatch_arg_0: impl Read + IoBuf, __enum_dispatch_arg_1: &mut SendOptions, ) -> NetResult<usize>
Attempts to send data without parking the caller.
Source§fn try_recv(
&self,
__enum_dispatch_arg_0: impl Write + IoBufMut,
__enum_dispatch_arg_1: &mut RecvOptions<'_>,
) -> NetResult<usize>
fn try_recv( &self, __enum_dispatch_arg_0: impl Write + IoBufMut, __enum_dispatch_arg_1: &mut RecvOptions<'_>, ) -> NetResult<usize>
Attempts to receive data without parking the caller.
Source§fn recv_available(&self) -> NetResult<usize>
fn recv_available(&self) -> NetResult<usize>
Returns the number of bytes that can be read without blocking.
Source§fn local_addr(&self) -> NetResult<SocketAddrEx>
fn local_addr(&self) -> NetResult<SocketAddrEx>
Get the local endpoint of the socket.
Source§fn peer_addr(&self) -> NetResult<SocketAddrEx>
fn peer_addr(&self) -> NetResult<SocketAddrEx>
Get the remote endpoint of the socket.
Source§fn shutdown(&self, __enum_dispatch_arg_0: Shutdown) -> NetResult
fn shutdown(&self, __enum_dispatch_arg_0: Shutdown) -> NetResult
Shutdown the socket, closing the connection.
Source§fn send_wait_policy(
&self,
__enum_dispatch_arg_0: bool,
) -> NetResult<SocketWaitPolicy>
fn send_wait_policy( &self, __enum_dispatch_arg_0: bool, ) -> NetResult<SocketWaitPolicy>
Returns the send wait policy without acquiring scheduler ownership.
Source§fn recv_wait_policy(
&self,
__enum_dispatch_arg_0: bool,
) -> NetResult<SocketWaitPolicy>
fn recv_wait_policy( &self, __enum_dispatch_arg_0: bool, ) -> NetResult<SocketWaitPolicy>
Returns the receive wait policy without acquiring scheduler ownership.