pub struct RemovalPlan { /* private fields */ }Expand description
An in-memory plan containing items to keep or delete beneath a root directory.
Created by crate::build_plan or crate::build_plan_with_options. Constructing or querying a RemovalPlan is strictly
read-only and never modifies the filesystem.
§Item Collections
A RemovalPlan separates discovered filesystem items into three collections:
keep_items: Contains all items directly matched by keep conditions, plus all ancestor directories required to preserve their paths from the root.delete_items: Contains every individual item targeted for deletion. This comprehensive list is suitable for full previews, logging, or reporting.delete_roots: Contains only the top-level deletion targets. When an entire directory is targeted for deletion, its descendants appear indelete_itemsbut are excluded fromdelete_roots. This minimal set is ideal for executing deletion via recursive removal routines without redundant operations.
Implementations§
Source§impl RemovalPlan
impl RemovalPlan
Sourcepub fn root(&self) -> &Path
pub fn root(&self) -> &Path
Returns the normalized root directory of the plan.
The root directory itself is never included in any keep or delete list.
Sourcepub fn direct_match_count(&self) -> usize
pub fn direct_match_count(&self) -> usize
Returns the number of items that directly matched all keep conditions.
Directories kept solely because they are ancestors of matched items are not included in this count.
Sourcepub fn modified_range(&self) -> Option<&ModifiedRange>
pub fn modified_range(&self) -> Option<&ModifiedRange>
Returns the modification-time range used to create the plan, if specified.
Sourcepub fn keep_items(&self) -> &[PlannedItem]
pub fn keep_items(&self) -> &[PlannedItem]
Returns all kept items and their required ancestor directories, sorted by relative path.
Sourcepub fn delete_items(&self) -> &[PlannedItem]
pub fn delete_items(&self) -> &[PlannedItem]
Returns all items targeted for deletion, sorted by relative path.
This is the complete, exhaustive list of all deletion targets, including items inside directories that will be removed.
Sourcepub fn delete_roots(&self) -> &[PlannedItem]
pub fn delete_roots(&self) -> &[PlannedItem]
Returns the minimal top-level items targeted for deletion, sorted by relative path.
If a directory is targeted for deletion, the directory itself is included in this list, but its child items are omitted. This provides the minimal set of targets needed to execute recursive deletion safely and efficiently.