pub struct TreeStats {
pub total_size: u64,
pub total_files: u64,
pub total_dirs: u64,
pub total_symlinks: u64,
pub max_depth: u32,
pub largest_file: Option<(PathBuf, u64)>,
pub oldest_file: Option<(PathBuf, SystemTime)>,
pub newest_file: Option<(PathBuf, SystemTime)>,
}Expand description
Summary statistics for a scanned tree.
Fields§
§total_size: u64Total size in bytes.
total_files: u64Total number of files.
total_dirs: u64Total number of directories.
total_symlinks: u64Total number of symbolic links.
max_depth: u32Maximum depth reached.
largest_file: Option<(PathBuf, u64)>Largest file (path, size).
oldest_file: Option<(PathBuf, SystemTime)>Oldest file (path, time).
newest_file: Option<(PathBuf, SystemTime)>Newest file (path, time).
Implementations§
Source§impl TreeStats
impl TreeStats
Sourcepub fn record_file(
&mut self,
path: &Path,
size: u64,
modified: Option<SystemTime>,
depth: u32,
)
pub fn record_file( &mut self, path: &Path, size: u64, modified: Option<SystemTime>, depth: u32, )
Update stats with a file entry. Only clones the path when updating a tracked field. Equal sizes/times choose the smallest native path, independent of arrival order.
modified is None when the file’s modification time could not be read;
such files are excluded from oldest/newest tracking rather than being
coerced to the Unix epoch (which would poison the “oldest file” result).
Sourcepub fn record_file_with(
&mut self,
size: u64,
modified: Option<SystemTime>,
depth: u32,
path: impl FnOnce() -> PathBuf,
)
pub fn record_file_with( &mut self, size: u64, modified: Option<SystemTime>, depth: u32, path: impl FnOnce() -> PathBuf, )
Self::record_file that builds the path only when it is needed:
when this file may become the largest, oldest or newest.
Sourcepub fn record_dir(&mut self, depth: u32)
pub fn record_dir(&mut self, depth: u32)
Record a directory.
Sourcepub fn record_symlink(&mut self)
pub fn record_symlink(&mut self)
Record a symlink.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TreeStats
impl<'de> Deserialize<'de> for TreeStats
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TreeStats, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TreeStats, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for TreeStats
impl Serialize for TreeStats
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for TreeStats
impl RefUnwindSafe for TreeStats
impl Send for TreeStats
impl Sync for TreeStats
impl Unpin for TreeStats
impl UnsafeUnpin for TreeStats
impl UnwindSafe for TreeStats
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more