StreamPool

Struct StreamPool 

Source
pub struct StreamPool<F: StreamFactory> { /* private fields */ }
Expand description

Represents a pool of streams, managing a collection of streams created by a factory.

Implementations§

Source§

impl<F: StreamFactory> StreamPool<F>

Source

pub fn new(backend: F, max_streams: u8, num_special: u8) -> Self

Creates a new stream pool with the given backend factory and capacity constraints.

Source

pub fn get_mut(&mut self, stream_id: &StreamId) -> &mut F::Stream

Retrieves a mutable reference to a stream for a given stream ID.

Source

pub unsafe fn get_mut_index(&mut self, index: usize) -> &mut F::Stream

Retrieves a mutable reference to a stream at the specified index, initializing it if needed.

§Safety
  • Caller must ensure the index is valid (less than max_streams + num_special).
  • Lifetimes still follow the Rust rules.
Source

pub unsafe fn get_special(&mut self, index: u8) -> &mut F::Stream

Retrieves a mutable reference to a special stream at the given index.

§Safety
  • Caller must ensure the index corresponds to a valid special stream.
  • Lifetimes still follow the Rust rules.
Source

pub fn stream_index(&mut self, id: &StreamId) -> usize

Calculates the index for a given stream ID, mapping it to the pool’s capacity.

Trait Implementations§

Source§

impl<F: Debug + StreamFactory> Debug for StreamPool<F>
where F::Stream: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<F> Freeze for StreamPool<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for StreamPool<F>

§

impl<F> Send for StreamPool<F>
where F: Send, <F as StreamFactory>::Stream: Send,

§

impl<F> Sync for StreamPool<F>
where F: Sync, <F as StreamFactory>::Stream: Sync,

§

impl<F> Unpin for StreamPool<F>
where F: Unpin, <F as StreamFactory>::Stream: Unpin,

§

impl<F> UnwindSafe for StreamPool<F>

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.
Source§

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

Source§

fn vzip(self) -> V