pub struct PaxBuilder { /* private fields */ }Expand description
Builder for PAX extended header records.
PAX extended headers contain key-value pairs that extend the basic tar header format, allowing for longer paths, larger file sizes, and additional metadata.
§Format
Each record has the format: <length> <key>=<value>\n
where <length> is the total record length including the length field itself.
§Example
use tar_core::builder::PaxBuilder;
let mut builder = PaxBuilder::new();
builder
.path(b"/very/long/path/that/exceeds/100/characters/limit.txt")
.size(1_000_000_000_000);
let data = builder.finish();Implementations§
Source§impl PaxBuilder
impl PaxBuilder
Sourcepub fn add(&mut self, key: &str, value: impl AsRef<[u8]>) -> &mut Self
pub fn add(&mut self, key: &str, value: impl AsRef<[u8]>) -> &mut Self
Add a key-value record.
The record is formatted as <length> <key>=<value>\n.
The length prefix includes itself, which requires computing how many
decimal digits the total length will occupy. This uses the same
algorithm as tar-rs’s append_pax_extensions.
Trait Implementations§
Source§impl Clone for PaxBuilder
impl Clone for PaxBuilder
Source§fn clone(&self) -> PaxBuilder
fn clone(&self) -> PaxBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PaxBuilder
impl Debug for PaxBuilder
Source§impl Default for PaxBuilder
impl Default for PaxBuilder
Source§fn default() -> PaxBuilder
fn default() -> PaxBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PaxBuilder
impl RefUnwindSafe for PaxBuilder
impl Send for PaxBuilder
impl Sync for PaxBuilder
impl Unpin for PaxBuilder
impl UnsafeUnpin for PaxBuilder
impl UnwindSafe for PaxBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more