#[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
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).
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.
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.
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.
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
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.
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.
Trait Implementations§
Source§impl Debug for AssemblyError
impl Debug for AssemblyError
Source§impl Display for AssemblyError
impl Display for AssemblyError
Source§impl Error for AssemblyError
impl Error for AssemblyError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for AssemblyError
impl PartialEq for AssemblyError
Source§fn eq(&self, other: &AssemblyError) -> bool
fn eq(&self, other: &AssemblyError) -> bool
self and other values to be equal, and is used by ==.