Skip to main content

Hit

Struct Hit 

Source
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: PathBuf

The path itself.

§claim: Claim

Which tier claimed it, and everything that tier knows.

§size: Size

What 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

Source

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.

Source

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.

Source

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”.

Source

pub fn rule(&self) -> Option<&Rule>

The rule that claimed this directory, or None when no rule did.

Source

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§

Source§

impl Clone for Hit

Source§

fn clone(&self) -> Hit

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Hit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&Hit> for Target

Source§

fn from(hit: &Hit) -> Self

Converts to this type from the input type.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.