Skip to main content

UdpCaps

Struct UdpCaps 

Source
pub struct UdpCaps {
    pub max_send_segments: usize,
    pub max_recv_segments: usize,
    pub ecn: bool,
    pub may_fragment: bool,
}
Expand description

Which offloads a socket has.

§Three answers, not one boolean

They degrade independently, and the stack that consumes them already treats them so — max_transmit_segments, max_receive_segments and a per-datagram ecn field are three separate questions on quinn::AsyncUdpSocket, with may_fragment a fourth. Collapsing them into one bool would be the mistake TcpOptsSupport exists not to make: the caller’s decision differs per offload, so the report must too.

Measured on x86-64 Linux 7.0.0 for a plain std::net::UdpSocket: max_send_segments = 64, max_recv_segments = 64, ecn = true, may_fragment = false. Those are that kernel’s numbers, not this crate’s: they are what the report exists to carry.

Fields§

§max_send_segments: usize

Datagrams one try_send may carry. 1 means no GSO.

§max_recv_segments: usize

Datagrams one poll_recv slot may describe. 1 means no GRO.

§ecn: bool

Whether Datagrams::ecn is applied on send and RecvMeta::ecn is filled in on receive.

§may_fragment: bool

Whether datagrams may be fragmented in flight — which makes path MTU discovery unreliable. true is the pessimistic answer, so it is the one in UdpCaps::NONE.

Implementations§

Source§

impl UdpCaps

Source

pub const NONE: Self

A socket with no offloads at all, and the default for UdpDatagrams::caps.

Note may_fragment: true — the worse answer, not the tidier one. Every field here is the value that costs a forgetful implementer an understatement rather than a promise it cannot keep, which is the rule TcpOptsSupport::NONE established.

Trait Implementations§

Source§

impl Clone for UdpCaps

Source§

fn clone(&self) -> UdpCaps

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for UdpCaps

Source§

impl Debug for UdpCaps

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for UdpCaps

Source§

impl PartialEq for UdpCaps

Source§

fn eq(&self, other: &UdpCaps) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for UdpCaps

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.