pub trait Socket: Source {
type Error;
const MAX_IOVECS: usize;
Show 14 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 peer_addr<E: From<Errno>>(
file: BorrowedFd<'_>,
address: &mut Storage,
) -> 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 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 recv_now<'a, E: From<Errno>>(
file: BorrowedFd<'_>,
output: &'a mut [u8],
) -> Result<&'a mut [u8], E> { ... }
fn send_to<'a, E: From<Errno>>(
file: BorrowedFd<'_>,
input: &'a [u8],
address: Addr<'_>,
) -> Result<&'a [u8], E> { ... }
fn recv_from<'a, E: From<Errno>>(
file: BorrowedFd<'_>,
output: &'a mut [u8],
address: &mut Storage,
) -> Result<&'a mut [u8], E> { ... }
}Expand description
Native socket creation and synchronous transfer.
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 peer_addr<E: From<Errno>>(
file: BorrowedFd<'_>,
address: &mut Storage,
) -> Result<(), E>
fn peer_addr<E: From<Errno>>( file: BorrowedFd<'_>, address: &mut Storage, ) -> Result<(), E>
Observes the connected peer into caller-owned native address storage.
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 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 recv_now<'a, E: From<Errno>>( file: BorrowedFd<'_>, output: &'a mut [u8], ) -> Result<&'a mut [u8], E>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".