Skip to main content

PaxDecodePolicy

Struct PaxDecodePolicy 

Source
pub struct PaxDecodePolicy { /* private fields */ }
Expand description

Controls pax compatibility and the feature subset member decoding may accept.

See each allow API for its default.

Implementations§

Source§

impl PaxDecodePolicy

Source

pub fn max_extension_size(self, max_extension_size: u64) -> Self

Configures the maximum payload size in bytes accepted for one pax extension.

The limit applies independently to each local or global extension and covers all records in that extension. An extension that declares a larger payload is rejected before its payload is consumed.

The default is DEFAULT_MAX_PAX_EXTENSION_SIZE. Setting the limit to zero rejects every nonempty pax extension. Setting it to u64::MAX removes the per-extension bound; global extensions remain subject to their cumulative limit.

Source

pub fn max_global_extensions_size(self, max_global_extensions_size: u64) -> Self

Configures the maximum cumulative payload size of global pax extensions.

The total is reset after each ordinary member. A global extension that would increase the pending total beyond this limit is rejected before its payload is consumed. The default is DEFAULT_MAX_GLOBAL_PAX_EXTENSIONS_SIZE. Setting the limit to zero rejects every nonempty global extension. Setting it to u64::MAX removes the cumulative bound; each extension remains subject to its individual limit.

Source

pub fn allow_non_utf8_pax_vendor_values(self, allow: bool) -> Self

Configures whether vendor-namespaced pax record values may contain non-UTF-8 bytes.

This compatibility option is enabled by default to accommodate raw extensions incorrectly emitted by other real-world writers. Disabling it requires every vendor record value to be valid UTF-8. Vendor values remain exposed as opaque bytes in either mode.

Self::allow_unknown_pax_vendor_records separately controls whether decoding may ignore vendor records after they have been parsed.

Source

pub fn allow_global_pax_extensions(self, allow: bool) -> Self

Configures whether global pax extension headers may be accepted.

When enabled, Self::allow_global_pax_member_metadata separately controls whether global path, linkpath, and size records are accepted. Trailing global headers without a following ordinary member are consumed and ignored before policy checks.

Global pax extension headers are allowed by default.

Source

pub fn allow_unknown_pax_vendor_records(self, allow: bool) -> Self

Configures whether unknown vendor-namespaced pax records may be accepted.

When enabled, well-formed vendor-namespaced pax records do not cause a decoding error. Their values are parsed structurally, but their semantics are not interpreted.

This can produce output that differs from the archive’s intended contents. For example, GNU.sparse.* records can change a member’s effective name, logical size, and mapping from stored payload bytes to file contents; these semantics are ignored when this option is enabled.

IMPORTANT: Only enable this when silently ignoring unknown vendor semantics is acceptable. Unknown vendor-namespaced pax records are forbidden by default.

Source

pub fn allow_duplicate_pax_records(self, allow: bool) -> Self

Configures whether one pax extended header may repeat a keyword.

When enabled, standard pax precedence applies and the last record for a repeated keyword takes effect.

Duplicated pax records within a single header are forbidden by default.

Source

pub fn allow_global_pax_member_metadata(self, allow: bool) -> Self

Configures whether global pax headers may set member path or size data.

When enabled, standard pax semantics permit global path, linkpath, and size records to apply to following members until overridden.

Member metadata within global pax headers is forbidden by default, as it is extremely differential-prone.

Trait Implementations§

Source§

impl Clone for PaxDecodePolicy

Source§

fn clone(&self) -> PaxDecodePolicy

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 PaxDecodePolicy

Source§

impl Debug for PaxDecodePolicy

Source§

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

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

impl Default for PaxDecodePolicy

Source§

fn default() -> Self

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

impl Eq for PaxDecodePolicy

Source§

impl PartialEq for PaxDecodePolicy

Source§

fn eq(&self, other: &PaxDecodePolicy) -> 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 StructuralPartialEq for PaxDecodePolicy

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