Struct include_dir::Dir
source · pub struct Dir<'a> { /* private fields */ }
Expand description
A directory.
Implementations§
source§impl<'a> Dir<'a>
impl<'a> Dir<'a>
sourcepub fn path(&self) -> &'a Path
pub fn path(&self) -> &'a Path
The full path for this Dir
, relative to the directory passed to
crate::include_dir!()
.
sourcepub fn files(&self) -> impl Iterator<Item = &'a File<'a>> + 'a
pub fn files(&self) -> impl Iterator<Item = &'a File<'a>> + 'a
Get a list of the files in this directory.
sourcepub fn dirs(&self) -> impl Iterator<Item = &'a Dir<'a>> + 'a
pub fn dirs(&self) -> impl Iterator<Item = &'a Dir<'a>> + 'a
Get a list of the sub-directories inside this directory.
sourcepub fn get_entry<S: AsRef<Path>>(&self, path: S) -> Option<&'a DirEntry<'a>>
pub fn get_entry<S: AsRef<Path>>(&self, path: S) -> Option<&'a DirEntry<'a>>
Recursively search for a DirEntry
with a particular path.
sourcepub fn get_file<S: AsRef<Path>>(&self, path: S) -> Option<&'a File<'a>>
pub fn get_file<S: AsRef<Path>>(&self, path: S) -> Option<&'a File<'a>>
Look up a file by name.
sourcepub fn extract<S: AsRef<Path>>(&self, base_path: S) -> Result<()>
pub fn extract<S: AsRef<Path>>(&self, base_path: S) -> Result<()>
Create directories and extract all files to real filesystem.
Creates parent directories of path
if they do not already exist.
Fails if some files already exist.
In case of error, partially extracted directory may remain on the filesystem.
Trait Implementations§
source§impl<'a> PartialEq for Dir<'a>
impl<'a> PartialEq for Dir<'a>
impl<'a> StructuralPartialEq for Dir<'a>
Auto Trait Implementations§
impl<'a> Freeze for Dir<'a>
impl<'a> RefUnwindSafe for Dir<'a>
impl<'a> Send for Dir<'a>
impl<'a> Sync for Dir<'a>
impl<'a> Unpin for Dir<'a>
impl<'a> UnwindSafe for Dir<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)