Skip to main content

MultiplexedConnection

Struct MultiplexedConnection 

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

Multiplexed connection supporting concurrent streams

Implementations§

Source§

impl MultiplexedConnection

Source

pub fn new() -> Self

Create a new multiplexed connection

Source

pub fn with_max_send_queue_len(max_send_queue_len: usize) -> Self

Create a new multiplexed connection with a bounded outbound frame queue.

Source

pub fn with_max_recv_buffer_bytes(max_recv_buffer_bytes: usize) -> Self

Create a new multiplexed connection with a bounded receive buffer.

Source

pub fn with_limits( max_send_queue_len: usize, max_recv_buffer_bytes: usize, ) -> Self

Create a new multiplexed connection with explicit transport limits.

Source

pub fn is_closed(&self) -> bool

Check if connection is closed

Source

pub fn stream_count(&self) -> u16

Get current stream count

Source

pub async fn open_stream(&self) -> Result<u16, MultiplexError>

Open a new stream

Source

pub async fn accept_stream(&self, stream_id: u16) -> Result<(), MultiplexError>

Accept an incoming stream (called when receiving SYN)

Source

pub async fn send( &self, stream_id: u16, data: Bytes, ) -> Result<(), MultiplexError>

Send data on a stream

Source

pub async fn recv( &self, stream_id: u16, ) -> Result<Option<Bytes>, MultiplexError>

Receive data from a stream

Source

pub async fn close_stream(&self, stream_id: u16) -> Result<(), MultiplexError>

Close a stream gracefully

Source

pub async fn reset_stream( &self, stream_id: u16, error: Option<String>, ) -> Result<(), MultiplexError>

Reset a stream with error

Source

pub async fn process_frame( &self, header: StreamHeader, payload: Bytes, ) -> Result<(), MultiplexError>

Process an incoming frame

Source

pub async fn take_frame(&self) -> Option<(StreamHeader, Bytes)>

Take next frame to send

Source

pub fn encode_frame(header: &StreamHeader, payload: &Bytes) -> Bytes

Encode a frame to bytes

Source

pub async fn stream_status( &self, stream_id: u16, ) -> Result<StreamStatus, MultiplexError>

Get stream status

Source

pub async fn close(&self)

Close the connection

Source

pub fn total_bytes_sent(&self) -> u64

Get total bytes sent

Source

pub fn total_bytes_received(&self) -> u64

Get total bytes received

Source

pub async fn has_stream(&self, stream_id: u16) -> bool

Check if a stream exists

Source

pub async fn active_streams(&self) -> Vec<u16>

Get all active stream IDs

Trait Implementations§

Source§

impl Default for MultiplexedConnection

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V