Skip to main content

Capabilities

Struct Capabilities 

Source
#[non_exhaustive]
pub struct Capabilities { pub tx_max_sdu: u16, pub rx_max_sdu: u16, pub duplex: Duplex, pub reliable: bool, pub arq: Arq, pub framing: Option<Framing>, }
Expand description

What a medium can do, as the medium itself would describe it.

Transmit and receive limits are separate because real media are asymmetric: Iridium SBD carries 340 bytes up and 270 down. Collapsing them to their minimum — as the withdrawn design did — silently wasted 21% of every paid uplink message (docs/architecture.md §4.9).

#[non_exhaustive] since 0.3: a capability a layer or a module adds (the ARQ, the firmware framing) must not break every implementor’s literal. Build one with Capabilities::new and the setters.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§tx_max_sdu: u16

Largest SDU the medium will transmit, in bytes.

u16 because Zenoh’s own BatchSize is u16, so a larger value could never be filled.

§rx_max_sdu: u16

Largest SDU the medium will deliver, in bytes.

A promise this backend makes, and the driver checks it (#75). An arrival larger than this counts rx_oversize_total and is logged as a contract violation; it is still delivered, because the batch is Zenoh’s to judge and discarding it here would be the driver deciding a question I1 gives to Zenoh.

It is not what stops a peer sending too much, and the distinction matters on an asymmetric bearer. batch_size is node-global and Zenoh negotiates the minimum of the two ends, so a pair configured inconsistently produces a small effective batch — 21% of a paid uplink slot wasted on SBD — never an oversized arrival. What an operator does with this number is size the far node’s batch_size, which is why Driver::start logs it as peer_max_batch_size (#82).

§duplex: Duplex

Whether transmit and receive contend.

§reliable: bool

Whether the medium delivers in order and without loss.

Per invariant I2 this must be the truth about the hardware, not an aspiration. A lane may only assert LaneKey::reliable over a medium that reports true here.

§arq: Arq

What retransmits a lost SDU, as the module states it (§4.13). The claim reliable rests on, made explicit: only Arq::Unbounded guarantees delivery.

§framing: Option<Framing>

How the firmware splits an SDU into air frames, where it does (#159). None is one SDU, one frame.

Implementations§

Source§

impl Capabilities

Source

pub fn new( tx_max_sdu: u16, rx_max_sdu: u16, duplex: Duplex, reliable: bool, ) -> Self

The four facts every medium states; arq defaults to none and framing to one frame per SDU, which the setters change.

Source

pub fn arq(self, arq: Arq) -> Self

With the module’s declared ARQ.

Source

pub fn framing(self, framing: Framing) -> Self

With the module’s declared firmware framing.

Trait Implementations§

Source§

impl Clone for Capabilities

Source§

fn clone(&self) -> Self

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 Capabilities

Source§

impl Debug for Capabilities

Source§

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

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

impl Eq for Capabilities

Source§

impl PartialEq for Capabilities

Source§

fn eq(&self, other: &Self) -> 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 Capabilities

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.