pub(super) struct Pending {
ids: BTreeMap<PackageId, DeliveryRecord>,
buf: DataBuf,
}
Expand description
Buffer for packages received out-of-order and thus awaiting the right moment to be delivered.
Fields§
§ids: BTreeMap<PackageId, DeliveryRecord>
§buf: DataBuf
Implementations§
source§impl Pending
impl Pending
pub(super) fn new() -> Self
sourcepub(super) fn store(&mut self, record: DeliveryRecord, data: &[u8])
pub(super) fn store(&mut self, record: DeliveryRecord, data: &[u8])
Stores a package as pending (i.e. cannot be delivered right away).
§Panics
-
When there already is a pending package with the given
id
. -
It is not a (semi-)ordered package.
-
If the data is longer than
MAX_PACKAGE_SIZE
.
sourcepub(super) fn pop_first(
&mut self,
bound: PackageId,
buf: &mut [u8]
) -> Option<(DeliveryRecord, usize)>
pub(super) fn pop_first( &mut self, bound: PackageId, buf: &mut [u8] ) -> Option<(DeliveryRecord, usize)>
Finds oldest (smallest) pending package older (smaller) than the given bound. Returns None if there is no such package. Otherwise, stores the package to the given buffer and returns original package delivery record and length of the package data (as stored to the buffer).
§Arguments
bound
- exclusive ID bound.
§Panics
Panics if buf
len is smaller than length of found data.
Auto Trait Implementations§
impl Freeze for Pending
impl RefUnwindSafe for Pending
impl Send for Pending
impl Sync for Pending
impl Unpin for Pending
impl UnwindSafe for Pending
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