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:
reserveawaits until the transport can accept one more payload and returns aLinkTxPermit.LinkTxPermit::allocallocates aWriteSlotbacked by the transport’s own buffer (bipbuffer slot, kernel write buffer, etc.), then the caller fills it and callsWriteSlot::commit.
reserve is the backpressure point.
Required Associated Types§
type Permit: LinkTxPermit + MaybeSend
Required Methods§
Sourcefn reserve(&self) -> impl Future<Output = Result<Self::Permit>> + MaybeSend + '_
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.
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.