Skip to main content

Source

Trait Source 

Source
pub trait Source:
    Prepare
    + Source
    + Source
    + Sized {
    type Control: Copy + AsRef<[u8]>;
    type Combined;

    // Required methods
    fn control(source: Address) -> Self::Control;
    fn compose(
        source: Self::Control,
        gso: Option<<Self as Source>::Mode>,
    ) -> Self::Combined;
    fn release(
        control: Self::Combined,
    ) -> (Self::Control, Option<<Self as Source>::Mode>);
    fn bytes(control: &mut Self::Combined) -> &[u8] ⓘ;

    // Provided method
    fn source(
        bind: SocketAddr,
        peer: SocketAddr,
    ) -> Result<(Address, Self::Control), Error> { ... }
}
Expand description

Selects the native ancillary encoding for a fixed datagram source.

Required Associated Types§

Source

type Control: Copy + AsRef<[u8]>

Source

type Combined

Owns the selected source and exactly the optional segmentation capability supplied.

Required Methods§

Source

fn control(source: Address) -> Self::Control

Source

fn compose( source: Self::Control, gso: Option<<Self as Source>::Mode>, ) -> Self::Combined

Source

fn release( control: Self::Combined, ) -> (Self::Control, Option<<Self as Source>::Mode>)

Source

fn bytes(control: &mut Self::Combined) -> &[u8] ⓘ

Provided Methods§

Source

fn source( bind: SocketAddr, peer: SocketAddr, ) -> Result<(Address, Self::Control), Error>

Preserves an explicit source; resolves wildcard binds once on a separate socket.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§