pub struct FileManifest { /* private fields */ }
Expand description

Represents a collection of files.

Files are keyed by their path. The file content is abstract and can be backed by multiple sources.

Implementations

Create a new instance that allows the storage of links.

Whether the instance has any files entries.

Add a file on the filesystem to the manifest.

The filesystem path must have a prefix specified which will be stripped from the manifest path. This prefix must appear in the passed path.

The stored file data is a reference to the file path. So that file must outlive this manifest instance.

Add a file on the filesystem to this manifest, reading file data into memory.

This is like add_path() except the file is read and its contents stored in memory. This ensures that the file can be materialized even if the source file is deleted.

source

pub fn add_file_entry(
    &mut self,
    path: impl AsRef<Path>,
    entry: impl Into<FileEntry>
) -> Result<(), FileManifestError>

Add a FileEntry to this manifest under the given path.

The path cannot contain relative paths and must not be absolute.

Add an iterable of File to this manifest.

Add a symlink to the manifest.

Merge the content of another manifest into this one.

All entries from the other manifest are overlayed into this manifest while preserving paths exactly. If this manifest already has an entry for a given path, it will be overwritten by an entry in the other manifest.

Obtain all relative directories contained within files in this manifest.

The root directory is not represented in the return value.

Resolve all required directories relative to another directory.

The root directory itself is included.

Whether this manifest contains the specified file path.

Obtain the entry for a given path.

Obtain an iterator over paths and file entries in this manifest.

Obtain an iterator of entries as File instances.

Remove an entry from this manifest.

Obtain entries in this manifest grouped by directory.

The returned map has keys corresponding to the relative directory and values of files in that directory.

The root directory is modeled by the None key.

Write files in this manifest to the specified path.

Existing files will be replaced if they exist.

Calls materialize_files() but removes the destination directory if it exists.

This ensures the content of the destination reflects exactly what’s defined in this manifest.

Ensure the content of all entries is backed by memory.

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

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.

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.