[][src]Trait hole_punch::SparseFile

pub trait SparseFile: Read + Seek {
    fn scan_chunks(&mut self) -> Result<Vec<Segment>, ScanError>;
}

Trait for objects that can have sparsity

Required methods

fn scan_chunks(&mut self) -> Result<Vec<Segment>, ScanError>

Scans the file to find its logical chunks

Will return a list of segments, ordered by their start position.

The ranges generated are guaranteed to cover all bytes in the file, up to the last non-zero byte in the last segment containing data. All files are considered to have a single hole of indeterminate length at the end, and this library may not included that hole.

Hole segments are guaranteed to represent a part of a file that does not contain any non-zero data, however, Data segments may represent parts of a file that contain what, logically, should be sparse segments. This is up to the mercy of your operating system and file system, please consult their documentation for how they handle sparse files for more details.

Does not make any guarantee about maintaining the Seek position of the file, always seek back to a known point after calling this method.

Errors

Will return Err(ScanError::UnsupportedPlatform) if support is not implemented for filesystem level hole finding on your system

Will return Err(ScanError::UnsupportedFileSystem) if support is implemented for your operating system, but the filesystem does not support sparse files

Will also return Err if any other I/O error occurs

Loading content...

Implementations on Foreign Types

impl SparseFile for File[src]

Loading content...

Implementors

Loading content...