pub struct MessagePool { /* private fields */ }
Expand description

Holds parts of multipart messages before all parts have arrived

Messages in vector under each prefix key are inserted at the correct index - are kept sorted example of the map

{
    '3B prefix': \[\[part_1\], \[part_2\], \[part3\]\], // these are ordered
    ...
    ...
}

Implementations§

source§

impl MessagePool

source

pub fn try_insert( &mut self, msg: P2pMessagePart ) -> Result<Option<P2pMessage>, Error>

Try insert another part of sliced message. Will return None if this is not last (or the only) message, else it will return just the data of this message (stripped of all the now unnecessart protocol meta data)

source

pub fn size(&self) -> u8

Returns how many message parts (regardless of which message is the part of) are currently being held by the internal state.

source

pub fn reset(&mut self)

Resets the internal state of the pool. This equals constructing of a new pool - all the message parts of unfinished messages inserted before calling of this method will be lost.

Trait Implementations§

source§

impl Default for MessagePool

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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

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

§

fn vzip(self) -> V