Skip to main content

RegularFileSource

Trait RegularFileSource 

Source
pub trait RegularFileSource {
    // Required methods
    fn archive_path(&self) -> &str;
    fn file_data_size(&self) -> u64;
    fn mode(&self) -> u32;
    fn mtime(&self) -> ArchiveTimestamp;
    fn open(&self) -> Result<Box<dyn Read + '_>, ArchiveWriteError>;

    // Provided methods
    fn entry_kind(&self) -> SourceEntryKind { ... }
    fn link_target(&self) -> Option<&[u8]> { ... }
    fn sparse_extents(&self) -> Option<&[SparseExtent]> { ... }
    fn portable_metadata(&self) -> PortableFileMetadata { ... }
    fn open_auxiliary(
        &self,
        ordinal: usize,
    ) -> Result<Box<dyn Read + '_>, ArchiveWriteError> { ... }
}
Expand description

Re-openable source for one primary archive member.

The writer may replan when options such as target volume sizing need another pass, so implementations must return a fresh reader from each open call. Directory sources return an empty reader and a zero file_data_size.

Required Methods§

Source

fn archive_path(&self) -> &str

Source

fn file_data_size(&self) -> u64

Source

fn mode(&self) -> u32

Source

fn mtime(&self) -> ArchiveTimestamp

Source

fn open(&self) -> Result<Box<dyn Read + '_>, ArchiveWriteError>

Provided Methods§

Source

fn entry_kind(&self) -> SourceEntryKind

Link target bytes for a symbolic-link or hardlink source.

Source

fn sparse_extents(&self) -> Option<&[SparseExtent]>

Canonical allocated extents for a sparse regular file.

file_data_size remains the logical size. When this returns Some, open must yield exactly the concatenated extent bytes in ascending map order. Some(&[]) represents an all-hole sparse file.

Source

fn portable_metadata(&self) -> PortableFileMetadata

Source

fn open_auxiliary( &self, ordinal: usize, ) -> Result<Box<dyn Read + '_>, ArchiveWriteError>

Opens a streamed auxiliary payload by its canonical ordinal.

The default serves inline payloads. Sources using NativeAuxiliaryMetadata::new_streamed must override this method and return a fresh reader on every call.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§