Skip to main content

StreamMuxSender

Struct StreamMuxSender 

Source
pub struct StreamMuxSender { /* private fields */ }
Expand description

Sender side of the stream multiplexer.

Implementations§

Source§

impl StreamMuxSender

Source

pub fn bind<A: ToSocketAddrs>( local: A, peer: SocketAddr, symbol_len: usize, conn_window: u32, per_stream_window: u32, ) -> Result<Self>

Bind a local socket and connect to peer, coding over symbol_len-byte symbols. conn_window caps total outstanding symbols; per_stream_window caps each stream’s share.

Source

pub fn conn_id(&self) -> u64

The connection id stamped into every frame.

Source

pub fn stream_protection(&self, stream_id: u32) -> Option<Protection>

The FEC policy a stream was opened with, if it exists.

Source

pub fn local_addr(&self) -> Result<SocketAddr>

The sender’s local address.

Source

pub fn open_stream(&mut self, stream_id: u32, protection: Protection)

Open a stream with the given FEC policy. Re-opening keeps the existing stream (the policy is fixed at first open).

Source

pub fn write(&mut self, stream_id: u32, data: &[u8], fin: bool) -> Result<()>

Write data on stream_id. Full symbols are emitted immediately; a partial tail is buffered until the next write or fin. With fin set the stream is closed: the buffered tail goes out as the final (short) symbol and a reliable STREAM_FIN announces its index and length.

Source

pub fn pump(&mut self) -> Result<()>

Drain incoming NAK / ACK frames: retransmit NAK’d symbols and advance each stream’s acked frontier (which frees the flow windows). Also resends the STREAM_FIN of any finished-but-unacked stream on a slow cadence, so a terminator lost while other streams are still being written still converges (not only once the final flush begins).

Source

pub fn flush(&mut self, timeout: Duration) -> Result<bool>

Block until every stream is fully acked (all flow windows empty and each finished stream’s frontier past its final symbol) or the timeout elapses. Resends each finished stream’s STREAM_FIN so a lost terminator converges.

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> 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, 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.