aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-class-map-generator/src/class_map_generator.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe-class-map-generator/src/class_map_generator.rs')
-rw-r--r--crates/shirabe-class-map-generator/src/class_map_generator.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/shirabe-class-map-generator/src/class_map_generator.rs b/crates/shirabe-class-map-generator/src/class_map_generator.rs
index 733915e..a49ce66 100644
--- a/crates/shirabe-class-map-generator/src/class_map_generator.rs
+++ b/crates/shirabe-class-map-generator/src/class_map_generator.rs
@@ -45,7 +45,7 @@ impl ClassMapGenerator {
/// When calling scanPaths repeatedly with paths that may overlap, calling this will ensure that the same class is never scanned twice
pub fn avoid_duplicate_scans(&mut self, scanned_files: Option<FileList>) -> &mut Self {
- self.scanned_files = Some(scanned_files.unwrap_or_else(FileList::new));
+ self.scanned_files = Some(scanned_files.unwrap_or_default());
self
}
@@ -60,6 +60,11 @@ impl ClassMapGenerator {
&self.class_map
}
+ /// Take ownership of the inner ClassMap, leaving a default in its place.
+ pub fn take_class_map(&mut self) -> ClassMap {
+ std::mem::take(&mut self.class_map)
+ }
+
/// Iterate over all files in the given directory searching for classes
pub fn scan_paths(
&mut self,