Skip to main content

Reassembly

Enum Reassembly 

Source
pub enum Reassembly {
    Complete {
        count: usize,
    },
    Incomplete {
        have: Vec<u32>,
        missing: Vec<u32>,
        missing_count: u64,
        terminated: bool,
    },
    Orphan {
        reason: OrphanReason,
        have: Vec<u32>,
    },
    Empty,
}
Expand description

What a run of partials adds up to.

Variants§

§

Complete

Every partial from the first to a terminal one is present.

Fields

§count: usize

How many records the run holds.

§

Incomplete

The run starts correctly but has holes, or has not ended.

Fields

§have: Vec<u32>

Sequence numbers present in the run, ascending.

§missing: Vec<u32>

Sequence numbers missing between the ones present.

Truncated to PartialRun::MAX_REPORTED_MISSING; the exact figure is always missing_count.

§missing_count: u64

How many sequence numbers are missing in total.

Separate from missing.len() because the list is bounded and this is not: one corrupt sequence field claiming partial 4 294 967 295 would otherwise ask for a sixteen-gigabyte list of holes, and a decoder that allocates on a number an attacker chose is a denial of service with a domain name on it.

§terminated: bool

true when a terminal record has arrived.

A run with no holes and no terminal record is not broken — it is still open, and more partials are expected.

§

Orphan

The run cannot be completed from what arrived.

Either it does not begin at sequence 1, or its first record is reduced and therefore has no basis to be completed against.

Fields

§reason: OrphanReason

Why the run cannot be reassembled.

§have: Vec<u32>

Sequence numbers present in the run, ascending.

§

Empty

No partials at all.

Implementations§

Source§

impl Reassembly

Source

pub const fn is_complete(&self) -> bool

true when the run is whole and may be billed.

Source

pub const fn may_still_complete(&self) -> bool

true when more records may still arrive to finish the run.

An orphan cannot be finished by waiting: what is missing is the basis the run needed to be readable at all.

Source

pub fn missing(&self) -> &[u32]

The sequence numbers still outstanding, up to PartialRun::MAX_REPORTED_MISSING of them.

Source

pub const fn missing_count(&self) -> u64

How many sequence numbers are outstanding, exactly.

Always the true figure, even where missing was truncated.

Source

pub fn missing_is_truncated(&self) -> bool

true when missing lists fewer holes than there are.

Trait Implementations§

Source§

impl Clone for Reassembly

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Reassembly

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for Reassembly

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for Reassembly

Source§

impl PartialEq for Reassembly

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Reassembly

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.