Struct tugger_file_manifest::FileManifest [−][src]
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]
pub fn is_empty(&self) -> bool
[src]
Whether the instance has any files entries.
pub fn add_path(
&mut self,
path: impl AsRef<Path>,
strip_prefix: impl AsRef<Path>
) -> Result<(), FileManifestError>
[src]
&mut self,
path: impl AsRef<Path>,
strip_prefix: impl AsRef<Path>
) -> Result<(), FileManifestError>
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]
&mut self,
path: impl AsRef<Path>,
strip_prefix: impl AsRef<Path>
) -> Result<(), FileManifestError>
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]
&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.
pub fn add_files(
&mut self,
files: impl Iterator<Item = File>
) -> Result<(), FileManifestError>
[src]
&mut self,
files: impl Iterator<Item = File>
) -> Result<(), FileManifestError>
Add an iterable of File
to this manifest.
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]
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]
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]
Whether this manifest contains the specified file path.
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]
Obtain an iterator over paths and file entries in this manifest.
pub fn iter_files(&self) -> impl Iterator<Item = File> + '_
[src]
Obtain an iterator of entries as File
instances.
pub fn entries_by_directory(
&self
) -> BTreeMap<Option<&Path>, BTreeMap<&OsStr, &FileEntry>>
[src]
&self
) -> BTreeMap<Option<&Path>, BTreeMap<&OsStr, &FileEntry>>
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]
&self,
dest: impl AsRef<Path>
) -> Result<Vec<PathBuf>, FileManifestError>
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]
&self,
dest: impl AsRef<Path>
) -> Result<Vec<PathBuf>, FileManifestError>
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]
fn clone(&self) -> FileManifest
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for FileManifest
[src]
impl Default for FileManifest
[src]
fn default() -> FileManifest
[src]
impl PartialEq<FileManifest> for FileManifest
[src]
fn eq(&self, other: &FileManifest) -> bool
[src]
fn ne(&self, other: &FileManifest) -> bool
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,