pub struct Hit {
pub path: PathBuf,
pub claim: Claim,
pub size: Size,
pub modified: Option<SystemTime>,
}Expand description
One reclaimable thing: a directory, or — when the walk was asked for them — a gitignored file.
Fields§
§path: PathBufThe path itself.
claim: ClaimWhich tier claimed it, and everything that tier knows.
size: SizeWhat is known about the size. For a tier-one claim, Size::Unmeasured unless a
breakdown was asked for, because measuring means enumerating the subtree the scan
deliberately pruned at. A tier-two claim always carries a real number: a directory
could not have been claimed without a full pass over it, so there was nothing left to
save, and a file is one lstat the walk had already done.
modified: Option<SystemTime>The directory’s own mtime. The best single proxy for “do I still need this”.
Implementations§
Source§impl Hit
impl Hit
Sourcepub fn age(&self, now: SystemTime) -> Option<Duration>
pub fn age(&self, now: SystemTime) -> Option<Duration>
How long ago the directory was last touched, or None if the clock disagrees with
the filesystem.
Sourcepub fn label(&self) -> Cow<'_, str>
pub fn label(&self) -> Cow<'_, str>
What this directory is: the ecosystem and the kind, or UNLABELLED when only git
knows the directory at all.
A fact rather than a hint, which is the whole reason it replaced the command that used
to sit here. “node_modules is Node Dependencies” is checked; “npm install brings it
back” was a guess about a package manager, on a machine nothing here had looked at.
Sourcepub fn kind(&self) -> Option<Kind>
pub fn kind(&self) -> Option<Kind>
What kind of artefact this is, or None when nothing knows what it is.
The half of a label a machine can act on, which is what the closed vocabulary bought:
“show me every cache” is a question the front end can answer, and the None is not a
gap to be filled in but the tier-two claim’s own content — see IgnoredClaim.
A kind no longer implies a rule. A gitignored file can carry one, read off its name
by Kind::of_ignored_file, so “which tier claimed this” is Hit::is_ignored_file
and Hit::rule rather than “does it have a kind”.
Sourcepub fn rule(&self) -> Option<&Rule>
pub fn rule(&self) -> Option<&Rule>
The rule that claimed this directory, or None when no rule did.
Sourcepub fn is_ignored_file(&self) -> bool
pub fn is_ignored_file(&self) -> bool
Whether this claim is a gitignored file rather than a directory.
The one question the front end asks about the shape of a candidate, because a file is
a different job from the one the sweep does — see crate::tui::lens, where it is an
axis of its own rather than a third value on the tier axis.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Hit
impl RefUnwindSafe for Hit
impl Send for Hit
impl Sync for Hit
impl Unpin for Hit
impl UnsafeUnpin for Hit
impl UnwindSafe for Hit
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,
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