Struct tugger_file_manifest::FileManifest [−][src]
pub struct FileManifest { /* fields omitted */ }
Represents a collection of files.
Files are keyed by their path. The file content is abstract and can be backed by multiple sources.
Implementations
impl FileManifest
[src]
impl FileManifest
[src]pub fn add_path(
&mut self,
path: impl AsRef<Path>,
strip_prefix: impl AsRef<Path>
) -> Result<(), FileManifestError>
[src]
pub fn add_path(
&mut self,
path: impl AsRef<Path>,
strip_prefix: impl AsRef<Path>
) -> Result<(), FileManifestError>
[src]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.
pub fn add_path_memory(
&mut self,
path: impl AsRef<Path>,
strip_prefix: impl AsRef<Path>
) -> Result<(), FileManifestError>
[src]
pub fn add_path_memory(
&mut self,
path: impl AsRef<Path>,
strip_prefix: impl AsRef<Path>
) -> Result<(), FileManifestError>
[src]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.
pub fn add_file_entry(
&mut self,
path: impl AsRef<Path>,
entry: impl Into<FileEntry>
) -> Result<(), FileManifestError>
[src]
pub fn add_file_entry(
&mut self,
path: impl AsRef<Path>,
entry: impl Into<FileEntry>
) -> Result<(), FileManifestError>
[src]Add a FileEntry
to this manifest under the given path.
The path cannot contain relative paths and must not be absolute.
pub fn add_files(
&mut self,
files: impl Iterator<Item = File>
) -> Result<(), FileManifestError>
[src]
pub fn add_files(
&mut self,
files: impl Iterator<Item = File>
) -> Result<(), FileManifestError>
[src]Add an iterable of File
to this manifest.
pub fn add_manifest(&mut self, other: &Self) -> Result<(), FileManifestError>
[src]
pub fn add_manifest(&mut self, other: &Self) -> Result<(), FileManifestError>
[src]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.
pub fn relative_directories(&self) -> Vec<PathBuf>
[src]
pub fn relative_directories(&self) -> Vec<PathBuf>
[src]Obtain all relative directories contained within files in this manifest.
The root directory is not represented in the return value.
pub fn resolve_directories(&self, relative_to: impl AsRef<Path>) -> Vec<PathBuf>
[src]
pub fn resolve_directories(&self, relative_to: impl AsRef<Path>) -> Vec<PathBuf>
[src]Resolve all required directories relative to another directory.
The root directory itself is included.
pub fn has_path(&self, path: impl AsRef<Path>) -> bool
[src]
pub fn has_path(&self, path: impl AsRef<Path>) -> bool
[src]Whether this manifest contains the specified file path.
pub fn get(&self, path: impl AsRef<Path>) -> Option<&FileEntry>
[src]
pub fn get(&self, path: impl AsRef<Path>) -> Option<&FileEntry>
[src]Obtain the entry for a given path.
pub fn iter_entries(&self) -> Iter<'_, PathBuf, FileEntry>
[src]
pub fn iter_entries(&self) -> Iter<'_, PathBuf, FileEntry>
[src]Obtain an iterator over paths and file entries in this manifest.
pub fn iter_files(&self) -> impl Iterator<Item = File> + '_
[src]
pub fn iter_files(&self) -> impl Iterator<Item = File> + '_
[src]Obtain an iterator of entries as File
instances.
pub fn remove(&mut self, path: impl AsRef<Path>) -> Option<FileEntry>
[src]
pub fn remove(&mut self, path: impl AsRef<Path>) -> Option<FileEntry>
[src]Remove an entry from this manifest.
pub fn entries_by_directory(
&self
) -> BTreeMap<Option<&Path>, BTreeMap<&OsStr, (&Path, &FileEntry)>>
[src]
pub fn entries_by_directory(
&self
) -> BTreeMap<Option<&Path>, BTreeMap<&OsStr, (&Path, &FileEntry)>>
[src]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.
pub fn materialize_files(
&self,
dest: impl AsRef<Path>
) -> Result<Vec<PathBuf>, FileManifestError>
[src]
pub fn materialize_files(
&self,
dest: impl AsRef<Path>
) -> Result<Vec<PathBuf>, FileManifestError>
[src]Write files in this manifest to the specified path.
Existing files will be replaced if they exist.
pub fn materialize_files_with_replace(
&self,
dest: impl AsRef<Path>
) -> Result<Vec<PathBuf>, FileManifestError>
[src]
pub fn materialize_files_with_replace(
&self,
dest: impl AsRef<Path>
) -> Result<Vec<PathBuf>, FileManifestError>
[src]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.
Trait Implementations
impl Clone for FileManifest
[src]
impl Clone for FileManifest
[src]fn clone(&self) -> FileManifest
[src]
fn clone(&self) -> FileManifest
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for FileManifest
[src]
impl Debug for FileManifest
[src]impl Default for FileManifest
[src]
impl Default for FileManifest
[src]fn default() -> FileManifest
[src]
fn default() -> FileManifest
[src]Returns the “default value” for a type. Read more
impl PartialEq<FileManifest> for FileManifest
[src]
impl PartialEq<FileManifest> for FileManifest
[src]fn eq(&self, other: &FileManifest) -> bool
[src]
fn eq(&self, other: &FileManifest) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &FileManifest) -> bool
[src]
fn ne(&self, other: &FileManifest) -> bool
[src]This method tests for !=
.
impl StructuralPartialEq for FileManifest
[src]
Auto Trait Implementations
impl RefUnwindSafe for FileManifest
impl Send for FileManifest
impl Sync for FileManifest
impl Unpin for FileManifest
impl UnwindSafe for FileManifest
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more