pub trait Socket: Source {
type Error;
type Records: Transport;
const MAX_IOVECS: usize;
Show 16 methods
// Required methods
fn socket(domain: c_int, kind: c_int) -> Result<OwnedFd, Self::Error>;
fn pair() -> Result<(OwnedFd, OwnedFd), Error>;
// Provided methods
fn datagram<E: From<Errno>>(domain: Domain) -> Result<OwnedFd, E> { ... }
fn try_open<E: From<Errno>>(
domain: c_int,
kind: c_int,
protocol: c_int,
) -> Result<OwnedFd, E> { ... }
fn listen<E: From<Errno>>(
file: BorrowedFd<'_>,
backlog: c_int,
) -> Result<(), E> { ... }
fn shutdown<E: From<Errno>>(file: BorrowedFd<'_>, how: How) -> Result<(), E> { ... }
fn kind<E: From<Errno>>(file: BorrowedFd<'_>) -> Result<Type, E> { ... }
fn is_listening<E: From<Errno>>(file: BorrowedFd<'_>) -> Result<bool, E> { ... }
fn set_reuse<E: From<Errno>>(
file: BorrowedFd<'_>,
reuse: Reuse,
) -> Result<(), E> { ... }
fn send_quiet<'a, E: From<Errno>>(
file: BorrowedFd<'_>,
input: &'a [u8],
) -> Result<&'a [u8], E> { ... }
fn send_now<'a, E: From<Errno>>(
file: BorrowedFd<'_>,
input: &'a [u8],
) -> Result<&'a [u8], E> { ... }
fn get_option<const OPTION: c_int, E: From<Errno>>(
file: BorrowedFd<'_>,
) -> Result<c_int, E> { ... }
fn set_option<E: From<Errno>>(
file: BorrowedFd<'_>,
level: c_int,
option: c_int,
value: &c_int,
) -> Result<(), E> { ... }
fn send<'a, const FLAGS: c_int, E: From<Errno>>(
file: BorrowedFd<'_>,
input: &'a [u8],
) -> Result<&'a [u8], E> { ... }
fn recv<'a, const FLAGS: c_int, E: From<Errno>>(
file: BorrowedFd<'_>,
output: &'a mut [u8],
) -> Result<&'a mut [u8], E> { ... }
fn try_pair<E: From<Errno>>(kind: c_int) -> Result<(OwnedFd, OwnedFd), E> { ... }
}Expand description
Native socket creation and asynchronous tuning capability.
Required Associated Constants§
const MAX_IOVECS: usize
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn datagram<E: From<Errno>>(domain: Domain) -> Result<OwnedFd, E>
fn datagram<E: From<Errno>>(domain: Domain) -> Result<OwnedFd, E>
Creates one datagram descriptor without changing its descriptor flags.
fn try_open<E: From<Errno>>( domain: c_int, kind: c_int, protocol: c_int, ) -> Result<OwnedFd, E>
fn listen<E: From<Errno>>(file: BorrowedFd<'_>, backlog: c_int) -> Result<(), E>
Sourcefn shutdown<E: From<Errno>>(file: BorrowedFd<'_>, how: How) -> Result<(), E>
fn shutdown<E: From<Errno>>(file: BorrowedFd<'_>, how: How) -> Result<(), E>
Half-closes one socket in the requested direction.
Sourcefn kind<E: From<Errno>>(file: BorrowedFd<'_>) -> Result<Type, E>
fn kind<E: From<Errno>>(file: BorrowedFd<'_>) -> Result<Type, E>
Observes the socket type of one adopted descriptor.
Sourcefn is_listening<E: From<Errno>>(file: BorrowedFd<'_>) -> Result<bool, E>
fn is_listening<E: From<Errno>>(file: BorrowedFd<'_>) -> Result<bool, E>
Whether one adopted descriptor is already listening.
Sourcefn set_reuse<E: From<Errno>>(
file: BorrowedFd<'_>,
reuse: Reuse,
) -> Result<(), E>
fn set_reuse<E: From<Errno>>( file: BorrowedFd<'_>, reuse: Reuse, ) -> Result<(), E>
Admits the requested address reuse on one socket.
Sourcefn send_quiet<'a, E: From<Errno>>(
file: BorrowedFd<'_>,
input: &'a [u8],
) -> Result<&'a [u8], E>
fn send_quiet<'a, E: From<Errno>>( file: BorrowedFd<'_>, input: &'a [u8], ) -> Result<&'a [u8], E>
Sends one byte string without raising the termination signal.
Sourcefn send_now<'a, E: From<Errno>>(
file: BorrowedFd<'_>,
input: &'a [u8],
) -> Result<&'a [u8], E>
fn send_now<'a, E: From<Errno>>( file: BorrowedFd<'_>, input: &'a [u8], ) -> Result<&'a [u8], E>
Sends without waiting or raising the termination signal.
fn get_option<const OPTION: c_int, E: From<Errno>>( file: BorrowedFd<'_>, ) -> Result<c_int, E>
fn set_option<E: From<Errno>>( file: BorrowedFd<'_>, level: c_int, option: c_int, value: &c_int, ) -> Result<(), E>
fn send<'a, const FLAGS: c_int, E: From<Errno>>( file: BorrowedFd<'_>, input: &'a [u8], ) -> Result<&'a [u8], E>
fn recv<'a, const FLAGS: c_int, E: From<Errno>>( file: BorrowedFd<'_>, output: &'a mut [u8], ) -> Result<&'a mut [u8], E>
fn try_pair<E: From<Errno>>(kind: c_int) -> Result<(OwnedFd, OwnedFd), E>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".