pub struct Cleaner;Expand description
Handles the cleanup of build directories from development projects.
The Cleaner struct provides methods for removing build directories
(such as target/ for Rust projects and node_modules/ for Node.js projects)
with parallel processing, progress reporting, and comprehensive error handling.
Implementations§
Source§impl Cleaner
impl Cleaner
Sourcepub fn clean_projects(
projects: Projects,
keep_executables: bool,
quiet: bool,
removal_strategy: RemovalStrategy,
) -> CleanResult
pub fn clean_projects( projects: Projects, keep_executables: bool, quiet: bool, removal_strategy: RemovalStrategy, ) -> CleanResult
Clean build directories from a collection of projects.
This method performs the main cleanup operation by:
- Setting up a progress bar for user feedback (unless
quiet) - Processing projects in parallel for efficiency
- Collecting and reporting any errors that occur
- Returning a
CleanResultwith detailed statistics
§Arguments
projects- A collection of projects to cleankeep_executables- Whether to preserve compiled executables before cleaningquiet- Whentrue, suppresses all human-readable output (progress bars, messages). Used by the--jsonflag so that only the final JSON is printed.removal_strategy- Whether to permanently delete or move to system trash
§Panics
This method may panic if the progress bar template string is invalid, though this should not occur under normal circumstances as the template is hardcoded and valid.
§Returns
A CleanResult containing success/failure counts, total freed bytes,
and any error messages.
§Performance
This method uses parallel processing to clean multiple projects simultaneously, which can significantly reduce cleanup time for large numbers of projects.
§Error Handling
Individual project cleanup failures do not stop the overall process.
All errors are collected and reported in the returned CleanResult,
allowing the cleanup to proceed for projects that can be successfully processed.
Sourcepub fn print_summary(result: &CleanResult)
pub fn print_summary(result: &CleanResult)
Print a human-readable cleanup summary to stdout.
This is called from main when --json is not active.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cleaner
impl RefUnwindSafe for Cleaner
impl Send for Cleaner
impl Sync for Cleaner
impl Unpin for Cleaner
impl UnsafeUnpin for Cleaner
impl UnwindSafe for Cleaner
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> 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