Skip to main content

ReassembledFile

Struct ReassembledFile 

Source
pub struct ReassembledFile {
    pub filename: String,
    pub mode: u32,
    pub data: Vec<u8>,
    pub is_truncated: bool,
    pub missing_parts: Vec<u32>,
}
Expand description

A successfully reassembled multi-part UU-encoded file.

Returned by reassemble. The data field holds the decoded binary payload; callers should inspect is_truncated before trusting the result.

§Security note

data may contain a compressed archive. This crate never decompresses the output. Apply independent size and resource limits before decompressing to protect against decompression-bomb attacks.

Fields§

§filename: String

Filename extracted from the begin line of the first UU part.

This is whatever filename appeared in the source message; it is not sanitised. Callers that write this to disk should validate it against path-traversal patterns.

§mode: u32

Unix permission mode (e.g. 0o644) from the begin line of the first part. Subsequent parts may specify different modes; only the first part’s value is used.

§data: Vec<u8>

Decoded binary payload, formed by concatenating the decoded output of each present part in ascending part_number order.

When is_truncated is true this slice is incomplete: it contains only the bytes contributed by the parts that were present.

§is_truncated: bool

true when one or more parts were absent from the collection, or when any individual part’s UU body was missing its end line. The data is likely corrupt in this case.

To distinguish the two truncation causes:

  • is_truncated && !missing_parts.is_empty() — gap in the collection.
  • is_truncated && missing_parts.is_empty() — all parts were present but at least one part’s UU body was itself truncated (missing end).
§missing_parts: Vec<u32>

Part numbers in 1..=total that were absent from the collection, in ascending order. Empty when the collection was complete.

Trait Implementations§

Source§

impl Debug for ReassembledFile

Source§

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

Formats the value using the given formatter. 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>,

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.