pub struct Socket { /* private fields */ }

Implementations

Creates a socket pair (AF_UNIX/SOCK_SEQPACKET).

Both sockets are close-on-exec by default.

Disables close-on-exec on the socket (to preserve it across process forks).

Reads bytes from the socket into the given scatter/gather array.

If file descriptors were passed, returns them too. To receive file descriptors, you need to instantiate the type parameter F as [RawFd; n], where n is the number of descriptors you want to receive.

Received file descriptors are set close-on-exec.

Reads bytes from the socket into the given buffer.

If file descriptors were passed, returns them too. To receive file descriptors, you need to instantiate the type parameter F as [RawFd; n], where n is the number of descriptors you want to receive.

Received file descriptors are set close-on-exec.

Reads bytes from the socket into a new buffer.

If file descriptors were passed, returns them too. To receive file descriptors, you need to instantiate the type parameter F as [RawFd; n], where n is the number of descriptors you want to receive.

Received file descriptors are set close-on-exec.

Reads bytes from the socket into a new buffer, also reading the first 64 bits as length. The resulting buffer is truncated to that length.

If file descriptors were passed, returns them too. To receive file descriptors, you need to instantiate the type parameter F as [RawFd; n], where n is the number of descriptors you want to receive.

Received file descriptors are set close-on-exec.

See recv_struct for docs

Safety
  • For some types (e.g.), not every bit pattern is allowed. If bytes, read from socket aren’t correct, that’s UB.
  • Some types mustn’t change their memory location (see std::pin::Pin). Sending object of such a type is UB.

Sends bytes from scatter-gather vectors over the socket.

Optionally passes file descriptors with the message.

Sends bytes from a slice over the socket.

Optionally passes file descriptors with the message.

Sends bytes from a slice over the socket, prefixing with the length (as a 64-bit unsigned integer).

Optionally passes file descriptors with the message.

See send_struct for docs.

Safety
  • T must not have padding bytes.
  • Also, if T violates recv_struct_raw safety preconditions, receiving it will trigger undefined behavior.

Trait Implementations

Extracts the raw file descriptor. Read more

Executes the destructor for this type. Read more

Constructs a new instance of Self from the given raw file descriptor. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.