Skip to main content

TocEntry

Struct TocEntry 

Source
pub struct TocEntry {
    pub filename: String,
    pub size_bytes: Option<u64>,
    pub parts: Option<RangeInclusive<u32>>,
}
Expand description

One entry in a table-of-contents post.

A TOC entry describes a single file within a multi-part series. Not all fields are present in every TOC format; size_bytes and parts are None when the corresponding information was absent from the line.

§Example

use uuencoding_multi::parse_toc;

let body = b"archive.tar.gz   1234567 bytes   parts 1-8\n";
let toc = parse_toc(body).unwrap();
let entry = &toc.entries[0];
assert_eq!(entry.filename, "archive.tar.gz");
assert_eq!(entry.size_bytes, Some(1_234_567));
assert_eq!(entry.parts, Some(1..=8));

Fields§

§filename: String

Filename as it appears in the TOC line.

§size_bytes: Option<u64>

Declared file size in bytes, if present. KB and MB values are converted to bytes (1 KB = 1 024 bytes, 1 MB = 1 048 576 bytes).

§parts: Option<RangeInclusive<u32>>

Which parts carry this file, if a range was specified. The range is inclusive on both ends (lo..=hi). Inverted ranges (lo > hi) are silently discarded and produce None.

Trait Implementations§

Source§

impl Debug for TocEntry

Source§

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

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

impl PartialEq for TocEntry

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 StructuralPartialEq for TocEntry

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.