Skip to main content

ContainerCaps

Struct ContainerCaps 

Source
pub struct ContainerCaps {
    pub read: bool,
    pub write: bool,
    pub forward_parse: bool,
    pub degraded_parse: bool,
    pub trailing_index: bool,
    pub solid: bool,
    pub per_entry_codec: bool,
    pub needs_seek: bool,
    pub stores_dirs: bool,
    pub stores_symlinks: bool,
    pub detects_corruption: CorruptionDetection,
}
Expand description

What a container can do, and what it needs from its input.

Fields§

§read: bool§write: bool§forward_parse: bool

Entries can be enumerated from a forward-only source at full data fidelity (metadata may be approximate). True for zip, tar, cpio.

§degraded_parse: bool

Only a best-effort salvage scan is possible forward-only. Distinct from forward_parse: this rung yields partial results by construction.

§trailing_index: bool

The authoritative index lives at the end of the stream (zip, 7z, rar).

§solid: bool

Entries share codec state, so reaching entry N decodes 1..N (7z, rar).

§per_entry_codec: bool

Each entry carries its own codec (zip, 7z).

§needs_seek: bool

Random access is required even to enumerate (squashfs, iso).

§stores_dirs: bool

A directory can be recorded AS a directory, rather than as an empty regular file that happens to share its name.

ar is the counter-example and the reason this field exists: its format has no directory concept at all, so writing one produces a zero-byte file named proj/sub — after which an entry named proj/sub/a.txt cannot be extracted, because its parent is a file. A writer that cannot store the kind is expected to be told so by its caller and warn, rather than emit the lie.

§stores_symlinks: bool

A symlink can be recorded as a link, target and all, rather than as a regular file carrying the target text as its contents.

§detects_corruption: CorruptionDetection

Whether reading an archive of this format will NOTICE a corrupted byte rather than silently returning wrong data — and, where it does, what kind of guarantee that is. The container-side twin of CodecCaps::detects_corruption, reusing the same enum and the same three meanings.

Read by the read-only conformance harness’s corruption property, and it is the reason that property is honest rather than merely strict: the harness flips the fixture’s middle byte and demands the read-back differ from the expectation, which a container with no integrity check at all cannot promise. A fixture whose midpoint lands in a reserved, comment or padding field no reader consults would fail a CORRECT container, and the module’s own rule is that properties skip on evidence, never on trust — ContainerCaps being one of the two admissible kinds of evidence.

Defaults to CorruptionDetection::Never via Self::read_only, Self::read_write and Default, so a container claims this the same way it claims every other capability here: explicitly. lha (CRC-16 per entry) and arj (CRC-32 per entry) are the first two to declare it.

Implementations§

Source§

impl ContainerCaps

Source

pub const fn read_only() -> Self

A container that can be read but not written — RAR, whose compressor is proprietary.

Source

pub const fn read_write() -> Self

A container supporting both directions. Every other capability stays false — a constructor must not claim what a format has not.

Trait Implementations§

Source§

impl Clone for ContainerCaps

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 Copy for ContainerCaps

Source§

impl Debug for ContainerCaps

Source§

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

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

impl Default for ContainerCaps

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for ContainerCaps

Source§

impl PartialEq for ContainerCaps

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 ContainerCaps

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