Skip to main content

AssemblyError

Enum AssemblyError 

Source
#[non_exhaustive]
pub enum AssemblyError { OverlappingPart { existing: Range<u64>, new: Range<u64>, }, OutOfRange { begin: u64, end: u64, total_size: u64, }, CrcMismatch { expected: u32, actual: u32, }, Incomplete { missing: Vec<Range<u64>>, }, DataLengthMismatch { declared_range_len: usize, actual_data_len: usize, }, TotalSizeTooLarge { total_size: u64, }, MalformedPartRange, InconsistentCrc { first: u32, new: u32, }, }
Expand description

Errors produced by crate::Assembler operations.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

OverlappingPart

A part’s byte range overlaps with an already-accepted part.

yEnc parts must cover non-overlapping, contiguous byte ranges of the final file. When two parts claim the same byte(s), the second is rejected. existing is the range already stored; new is the range that was rejected.

Caller action: de-duplicate incoming articles (the same article may arrive multiple times from different Usenet servers).

Fields

§existing: Range<u64>
§new: Range<u64>
§

OutOfRange

A part’s byte range falls outside [0, total_size).

Either the =ypart begin=/end= values were invalid, or the wrong total_size was passed to Assembler::new.

Fields

§begin: u64
§end: u64
§total_size: u64
§

CrcMismatch

Whole-file CRC32 mismatch on Assembler::finish.

The reassembled bytes hash to a different CRC32 than the expected value set via Assembler::set_expected_crc32.

Fields

§expected: u32
§actual: u32
§

Incomplete

Assembler::finish was called before all byte ranges were covered.

missing lists the 0-based byte ranges that have not been received. Call Assembler::is_complete before finish() to avoid this error.

Fields

§missing: Vec<Range<u64>>
§

DataLengthMismatch

A decoded part’s data length does not match its declared =ypart begin=/end= range.

This indicates a corrupt or malformed article: the decoded payload is a different size than the byte range it claims to cover.

Fields

§declared_range_len: usize

The byte count implied by the begin/end range header.

§actual_data_len: usize

The actual number of decoded bytes.

§

TotalSizeTooLarge

total_size exceeds the built-in safety cap or the addressable memory on this platform.

Assembler::new rejects any total_size greater than MAX_TOTAL_SIZE (512 MiB) to prevent an adversarial =ybegin size= field from forcing a multi-GiB allocation. On 32-bit targets the platform usize limit applies first.

Fields

§total_size: u64

The value that was rejected.

§

MalformedPartRange

A decoded part has part_begin set but part_end absent, or vice versa.

yEnc =ypart begin=/end= always provides both values or neither. A DecodedPart with only one of the two fields set indicates a corrupt or incorrectly constructed part.

§

InconsistentCrc

Two parts carry conflicting whole-file CRC32 values.

Assembler::add_part auto-extracts the crc32= whole-file CRC from each part that carries it. If a later part reports a different value than one already recorded, the series is internally inconsistent and the assembly must be aborted.

first is the CRC recorded from an earlier part; new is the conflicting value from the current part.

Fields

§first: u32
§new: u32

Trait Implementations§

Source§

impl Debug for AssemblyError

Source§

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

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

impl Display for AssemblyError

Source§

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

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

impl Error for AssemblyError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for AssemblyError

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for AssemblyError

Source§

impl StructuralPartialEq for AssemblyError

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

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.