ReassemblyPool

Struct ReassemblyPool 

Source
pub struct ReassemblyPool<const SLOTS: usize, const PAGES: usize> {
    pub slots: [Option<Slot>; SLOTS],
    /* private fields */
}
Expand description

Fixed-capacity reassembly pool.

Fields§

§slots: [Option<Slot>; SLOTS]

Implementations§

Source§

impl<const SLOTS: usize, const PAGES: usize> ReassemblyPool<SLOTS, PAGES>

Source

pub fn new() -> Self

Source

pub fn read_fragment( &self, slot_index: usize, fragment: u8, out: &mut [u8], ) -> usize

Copy a stored fragment into out (which must hold FRAGMENT_BODY_MAX bytes), returning its length.

Source

pub fn find_slot( &self, stream: &StreamKey, epoch: u16, message_id: u8, ) -> Option<usize>

Source

pub fn open_slot(&mut self, slot: Slot) -> Option<usize>

Source

pub fn oldest_slot(&self) -> Option<usize>

Index of the oldest incomplete slot, for eviction under pressure.

Source

pub fn close_slot(&mut self, index: usize) -> Option<Slot>

Release a slot and all its pages, returning it.

Source

pub fn drop_stream(&mut self, stream: &StreamKey) -> usize

Drop every slot belonging to stream (after a sequence reset), returning how many were dropped.

Source

pub fn insert_fragment( &mut self, index: usize, fragment: u8, bytes: &[u8], ) -> InsertOutcome

Store one fragment’s bytes into a slot.

Trait Implementations§

Source§

impl<const SLOTS: usize, const PAGES: usize> Default for ReassemblyPool<SLOTS, PAGES>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<const SLOTS: usize, const PAGES: usize> Freeze for ReassemblyPool<SLOTS, PAGES>

§

impl<const SLOTS: usize, const PAGES: usize> RefUnwindSafe for ReassemblyPool<SLOTS, PAGES>

§

impl<const SLOTS: usize, const PAGES: usize> Send for ReassemblyPool<SLOTS, PAGES>

§

impl<const SLOTS: usize, const PAGES: usize> Sync for ReassemblyPool<SLOTS, PAGES>

§

impl<const SLOTS: usize, const PAGES: usize> Unpin for ReassemblyPool<SLOTS, PAGES>

§

impl<const SLOTS: usize, const PAGES: usize> UnwindSafe for ReassemblyPool<SLOTS, PAGES>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

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
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.