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>
impl<F: StreamFactory> StreamPool<F>
Sourcepub fn new(backend: F, max_streams: u8, num_special: u8) -> Self
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.
Sourcepub fn get_mut(&mut self, stream_id: &StreamId) -> &mut F::Stream
pub fn get_mut(&mut self, stream_id: &StreamId) -> &mut F::Stream
Retrieves a mutable reference to a stream for a given stream ID.
Sourcepub unsafe fn get_mut_index(&mut self, index: usize) -> &mut F::Stream
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.
Sourcepub unsafe fn get_special(&mut self, index: u8) -> &mut F::Stream
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.
Sourcepub fn stream_index(&mut self, id: &StreamId) -> usize
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§
Auto Trait Implementations§
impl<F> Freeze for StreamPool<F>where
F: Freeze,
impl<F> RefUnwindSafe for StreamPool<F>
impl<F> Send for StreamPool<F>
impl<F> Sync for StreamPool<F>
impl<F> Unpin for StreamPool<F>
impl<F> UnwindSafe for StreamPool<F>
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