Skip to main content

StreamSlotMap

Struct StreamSlotMap 

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

A synchronous stream demultiplexer with explicit ownership transfer on reads.

Implementations§

Source§

impl StreamSlotMap

Source

pub const fn new(limits: StreamLimits) -> Self

Creates a client map. Zero limits intentionally disable buffering.

Source

pub const fn with_role(limits: StreamLimits, role: EndpointRole) -> Self

Creates an empty map for the specified local HTTP/2 endpoint role.

Source

pub fn open_stream(&mut self, stream_id: i32) -> SlotResult<()>

Opens a stream without allocating receive buffers.

§Errors

Rejects invalid/existing identifiers and new local streams after GOAWAY.

Source

pub fn get(&self, stream_id: i32) -> Option<&StreamSlot>

Looks up a stream without consuming events.

Source

pub fn active_stream_count(&self) -> usize

Number of retained stream slots, including closed slots awaiting removal.

Source

pub const fn goaway(&self) -> Option<(i32, u32)>

Most restrictive GOAWAY boundary and its associated HTTP/2 error code.

Source

pub fn push_initial_metadata( &mut self, stream_id: i32, headers: Headers, ) -> SlotResult<()>

Stores the initial header block exactly once, even after it is consumed.

§Errors

Rejects unknown/reset streams, duplicate or late headers, and budget excess.

Source

pub fn append_recv_bytes( &mut self, stream_id: i32, bytes: &[u8], ) -> SlotResult<()>

Accepts arbitrary DATA fragmentation and queues complete gRPC envelopes.

§Errors

Rejects missing headers, ended/reset streams, malformed flags or excess resources. Rejections preserve accepted frames and partial bytes.

Source

pub fn push_message( &mut self, stream_id: i32, message: StreamMessage, ) -> SlotResult<()>

Queues a complete envelope supplied by an upstream frame decoder.

§Errors

Rejects missing headers, ended/reset streams, partial frames or excess resources.

Source

pub fn push_trailing_metadata( &mut self, stream_id: i32, headers: Headers, ) -> SlotResult<()>

Stores trailers or a Trailers-Only response; mark END_STREAM separately.

§Errors

Rejects ended/reset streams, duplicate trailers, partial frames or excess resources.

Source

pub fn mark_remote_end_stream(&mut self, stream_id: i32) -> SlotResult<()>

Closes the peer’s sending half; request streams need not carry trailers.

§Errors

Rejects unknown/reset streams, duplicate END_STREAM and truncated envelopes.

Source

pub fn mark_local_end_stream(&mut self, stream_id: i32) -> SlotResult<()>

Closes the local sending half independently of the receive queues.

§Errors

Rejects unknown/reset streams or duplicate local END_STREAM.

Source

pub fn record_rst_stream( &mut self, stream_id: i32, error_code: u32, ) -> SlotResult<()>

Closes both halves, preserving completed responses for NO_ERROR resets.

§Errors

Rejects unknown streams and repeated resets, preserving the first code.

Source

pub fn apply_goaway( &mut self, last_stream_id: i32, error_code: u32, ) -> SlotResult<Vec<i32>>

Prunes excluded local streams; peer-initiated streams remain unaffected. Repeated GOAWAY frames can only reduce the accepted stream boundary.

§Errors

Rejects negative boundaries and increases to an established boundary.

Source

pub fn pop_initial_metadata( &mut self, stream_id: i32, ) -> SlotResult<Option<Headers>>

Transfers initial metadata ownership, leaving lifecycle history intact.

§Errors

Rejects unknown streams or resets other than completed-response NO_ERROR.

Source

pub fn pop_message( &mut self, stream_id: i32, ) -> SlotResult<Option<StreamMessage>>

Transfers the next message in stream order and releases its byte charge.

§Errors

Rejects unknown streams or resets other than completed-response NO_ERROR.

Source

pub fn take_trailers(&mut self, stream_id: i32) -> SlotResult<Option<Headers>>

Transfers trailers exactly once without changing the remote half state.

§Errors

Rejects unknown streams or resets other than completed-response NO_ERROR.

Source

pub fn remove_closed_stream(&mut self, stream_id: i32) -> SlotResult<StreamSlot>

Removes a reset or fully closed stream, including any unread events.

§Errors

Rejects unknown streams and streams with an open sending half.

Trait Implementations§

Source§

impl Debug for StreamSlotMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StreamSlotMap

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<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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.