Skip to main content

ConduitTx

Trait ConduitTx 

Source
pub trait ConduitTx {
    type Msg: MsgFamily;
    type Permit<'a>: for<'m> ConduitTxPermit<Msg = Self::Msg> + MaybeSend
       where Self: 'a;

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

Sending half of a Conduit.

Permit-based: reserve() is the backpressure point, permit.send() serializes and writes.

Required Associated Types§

Source

type Msg: MsgFamily

Source

type Permit<'a>: for<'m> ConduitTxPermit<Msg = Self::Msg> + MaybeSend where Self: 'a

Required Methods§

Source

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

Reserve capacity for one outbound message.

Backpressure lives here — this may block waiting for:

  • StableConduit: replay buffer capacity (bounded outstanding)
  • Flow control from the peer

Dropping the permit without sending releases the reservation.

Source

async fn close(self) -> Result<()>
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§