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)
pub fn clean_projects(projects: Projects)
Clean build directories from a collection of projects.
This method performs the main cleanup operation by:
- Setting up a progress bar for user feedback
- Processing projects in parallel for efficiency
- Collecting and reporting any errors that occur
- Providing detailed statistics about the cleanup results
§Arguments
projects- A collection of projects to clean
§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.
§Output
This method prints progress information and final statistics to stdout, including
- Real-time progress during cleanup
- Number of successfully cleaned projects
- Number of failed projects (if any)
- Total disk space freed
- Difference between estimated and actual space freed
§Examples
let projects = Projects::from(vec![/* project instances */]);
Cleaner::clean_projects(projects);§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 at the end, allowing the cleanup to proceed for projects that can be successfully processed.
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 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