Skip to main content

LinkTx

Trait LinkTx 

Source
pub trait LinkTx:
    MaybeSend
    + MaybeSync
    + 'static {
    type Permit: LinkTxPermit + MaybeSend;

    // Required methods
    fn reserve(
        &self,
    ) -> impl Future<Output = Result<Self::Permit>> + MaybeSend + '_;
    fn close(self) -> impl Future<Output = Result<()>> + MaybeSend
       where Self: Sized;
}
Expand description

Sending half of a Link.

Uses a two-phase write:

  1. reserve awaits until the transport can accept one more payload and returns a LinkTxPermit.
  2. LinkTxPermit::alloc allocates a WriteSlot backed by the transport’s own buffer (bipbuffer slot, kernel write buffer, etc.), then the caller fills it and calls WriteSlot::commit.

reserve is the backpressure point.

Required Associated Types§

Required Methods§

Source

fn reserve(&self) -> impl Future<Output = Result<Self::Permit>> + MaybeSend + '_

Reserve capacity to send exactly one payload.

Backpressure lives here — it awaits until the transport can accept a payload (or errors).

Dropping the returned permit without allocating/committing MUST release the reservation.

Source

fn close(self) -> impl Future<Output = Result<()>> + MaybeSend
where Self: Sized,

Graceful close of the outbound direction.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§