pub struct Deleter { /* private fields */ }Expand description
Removes what a Plan says to remove, and nothing else.
Implementations§
Source§impl Deleter
impl Deleter
Sourcepub fn threads(self, threads: usize) -> Self
pub fn threads(self, threads: usize) -> Self
How many threads to remove with. Defaults to the machine’s parallelism times
[OVERSUBSCRIPTION], bounded by [MAX_THREADS] and by the number of targets.
Sourcepub fn watching(self, sink: impl Fn(&Step) + Send + Sync + 'static) -> Self
pub fn watching(self, sink: impl Fn(&Step) + Send + Sync + 'static) -> Self
Reports the removal as it happens, rather than only in the Removal at the end.
The batch CLI has no use for this — it prints one report when the removal is over —
but a live view does, twice over. Step::Finished is what drops a row: a row for a
directory that is already gone is one a reader can still put a cursor on, and one they
can watch a second delete keystroke land on. Step::Freeing is what lets that row
empty first, on the bytes actually leaving the disk rather than on a timer — the
difference between showing what is happening and animating over the fact that it
already happened.
Called from the pool, so sink is Send + Sync and may be called from several
threads at once and in any order. A Finished sees exactly what Removal::removed
will contain — same condition, same values — because both come from
[Sweep::reported], and a Freeing is the same running total read earlier.
Sourcepub fn remove(&self, plan: &Plan) -> Removal
pub fn remove(&self, plan: &Plan) -> Removal
Executes the plan.
One target’s failure costs that target and nothing else: everything is collected and
reported, and the caller turns a non-empty Removal::failures into a non-zero exit.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Deleter
impl !UnwindSafe for Deleter
impl Freeze for Deleter
impl Send for Deleter
impl Sync for Deleter
impl Unpin for Deleter
impl UnsafeUnpin for Deleter
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