Struct dir_meta::DirMetadata
source · pub struct DirMetadata<'a> { /* private fields */ }Expand description
The Metadata of all directories and files in the current directory
Example
use dir_meta::DirMetadata;
let dir = DirMetadata::new("/path/to/directory").dir_metadata();Implementations§
source§impl<'a> DirMetadata<'a>
impl<'a> DirMetadata<'a>
sourcepub async fn dir_metadata(self) -> Result<DirMetadata<'a>, Error>
pub async fn dir_metadata(self) -> Result<DirMetadata<'a>, Error>
Returns an error if the directory cannot be accessed Read all the directories and files in the given path
sourcepub fn iter_dir<'life0, 'life_self, 'async_recursion>(
&'life_self mut self,
prepared_dir: &'life0 mut ReadDir
) -> Pin<Box<dyn Future<Output = &mut Self> + Send + 'async_recursion>>where
'life0: 'async_recursion,
'life_self: 'async_recursion,
pub fn iter_dir<'life0, 'life_self, 'async_recursion>(
&'life_self mut self,
prepared_dir: &'life0 mut ReadDir
) -> Pin<Box<dyn Future<Output = &mut Self> + Send + 'async_recursion>>where
'life0: 'async_recursion,
'life_self: 'async_recursion,
Recursively iterate over directories inside directories
sourcepub fn directories(&self) -> &[PathBuf]
pub fn directories(&self) -> &[PathBuf]
Get all the sub-directories of the current directory
sourcepub fn files(&self) -> &[FileMetadata<'a>]
pub fn files(&self) -> &[FileMetadata<'a>]
Get all the files in the current directory and all the files in it’s sub-directory
sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Get the size of the directory including the size of all files in the sub-directories
sourcepub fn size_formatted(&self) -> String
pub fn size_formatted(&self) -> String
Get the size of the directory including the size of all files in the sub-directories in human readable format
Trait Implementations§
source§impl<'a> Clone for DirMetadata<'a>
impl<'a> Clone for DirMetadata<'a>
source§fn clone(&self) -> DirMetadata<'a>
fn clone(&self) -> DirMetadata<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<'a> Debug for DirMetadata<'a>
impl<'a> Debug for DirMetadata<'a>
source§impl<'a> Default for DirMetadata<'a>
impl<'a> Default for DirMetadata<'a>
source§fn default() -> DirMetadata<'a>
fn default() -> DirMetadata<'a>
Returns the “default value” for a type. Read more
source§impl<'a> PartialEq for DirMetadata<'a>
impl<'a> PartialEq for DirMetadata<'a>
source§fn eq(&self, other: &DirMetadata<'a>) -> bool
fn eq(&self, other: &DirMetadata<'a>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl<'a> Eq for DirMetadata<'a>
impl<'a> StructuralEq for DirMetadata<'a>
impl<'a> StructuralPartialEq for DirMetadata<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for DirMetadata<'a>
impl<'a> Send for DirMetadata<'a>
impl<'a> Sync for DirMetadata<'a>
impl<'a> Unpin for DirMetadata<'a>
impl<'a> UnwindSafe for DirMetadata<'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