pub struct Volume<'data> {
    pub header: VolumeHeader<'data>,
    pub data: &'data [u8],
}
Expand description

Filesystem volume, containing the uncompressed files in an ordered directory structure

Fields

header: VolumeHeader<'data>

Header, storing all the offsets and file names in order

data: &'data [u8]

Volume filesystem

Implementations

Serialize an atom volume.

This is essentially Volume::serialize_files(), but it will modify the input files to uphold several atom-specific invariants - namely that each atom is addressable by its module name. This means:

  • All atoms are hoisted to the top level folder
  • Extensions are removed from filenames

Create a volume from a set of initial files

Returns all entries in a “tree” sorted structure, i.e. sorted in the same way you’d see the files in a tree explorer

Returns all the files in this volume, indexed by the full path (in unix fashion, i.e. “/”, “/a”, “/b/file.txt”)

Returns the number of files in this volume

Returns the number of directories in this volume

Parses a filesystem volume from a buffer of bytes

Returns file entries for $path

source

pub fn get_file_entry(&self, path: &str) -> Result<OwnedFsEntryFile, Error>

Returns the file entry for $path. Note that this does not return the file contents directly, use volume.get_file(path) instead.

Errors

Returns an error if the file is a directory.

Given an already-existing OwnedFsEntryFile, returns the byte slice for this file entry.

Errors

The function returns an error if the file entry is out of bounds of the underlying data slice (should never happen)

Returns the file contents (shorthand for volume.get_file_bytes(volume.get_file_entry(path)))

Serializes the volume into writable bytes (including the header and header length)

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.