pub struct StreamMultiplexer { /* private fields */ }Expand description
Stream multiplexer for managing multiple logical streams
Implementations§
Source§impl StreamMultiplexer
impl StreamMultiplexer
Sourcepub fn with_config(config: FlowControlConfig) -> Self
pub fn with_config(config: FlowControlConfig) -> Self
Create a new stream multiplexer with custom flow control config
Sourcepub async fn create_stream(
&self,
request_id: Option<Uuid>,
) -> Result<StreamHandle, ProtocolError>
pub async fn create_stream( &self, request_id: Option<Uuid>, ) -> Result<StreamHandle, ProtocolError>
Create a new stream
Sourcepub async fn route_frame(&self, frame: Frame) -> Result<(), ProtocolError>
pub async fn route_frame(&self, frame: Frame) -> Result<(), ProtocolError>
Route an incoming frame to the appropriate stream
Sourcepub async fn close_stream(&self, stream_id: u32) -> Result<(), ProtocolError>
pub async fn close_stream(&self, stream_id: u32) -> Result<(), ProtocolError>
Close a stream
Sourcepub async fn stream_count(&self) -> usize
pub async fn stream_count(&self) -> usize
Get the number of active streams
Sourcepub async fn stream_state(&self, stream_id: u32) -> Option<StreamState>
pub async fn stream_state(&self, stream_id: u32) -> Option<StreamState>
Get stream state
Sourcepub async fn process_frames(&self) -> Result<(), ProtocolError>
pub async fn process_frames(&self) -> Result<(), ProtocolError>
Process incoming frames (should be called in a loop)
Sourcepub fn send_frame(&self, frame: Frame) -> Result<(), ProtocolError>
pub fn send_frame(&self, frame: Frame) -> Result<(), ProtocolError>
Send a frame through the multiplexer
Sourcepub async fn can_send_data(
&self,
stream_id: u32,
size: u32,
) -> Result<bool, ProtocolError>
pub async fn can_send_data( &self, stream_id: u32, size: u32, ) -> Result<bool, ProtocolError>
Check if a stream can send data of the given size
Sourcepub async fn update_window(
&self,
stream_id: u32,
delta: u32,
) -> Result<(), ProtocolError>
pub async fn update_window( &self, stream_id: u32, delta: u32, ) -> Result<(), ProtocolError>
Update flow control window for a stream
Sourcepub async fn process_received_data(
&self,
stream_id: u32,
size: u32,
) -> Result<(), ProtocolError>
pub async fn process_received_data( &self, stream_id: u32, size: u32, ) -> Result<(), ProtocolError>
Process received data and update flow control
Sourcepub async fn ack_processed_data(
&self,
stream_id: u32,
size: u32,
) -> Result<(), ProtocolError>
pub async fn ack_processed_data( &self, stream_id: u32, size: u32, ) -> Result<(), ProtocolError>
Acknowledge processed data and return credits
Trait Implementations§
Source§impl Clone for StreamMultiplexer
impl Clone for StreamMultiplexer
Auto Trait Implementations§
impl !Freeze for StreamMultiplexer
impl !RefUnwindSafe for StreamMultiplexer
impl Send for StreamMultiplexer
impl Sync for StreamMultiplexer
impl Unpin for StreamMultiplexer
impl !UnwindSafe for StreamMultiplexer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more