Do not transform layers when transforming a parent folder (#481)

* Modify all message enum data to use named struct values, not tuples (#479)

* Massively reorganize and clean up the whole Rust codebase

* Modify all message enum data to use named struct values, not tuples

* Do not transform layers when transforming parent

* Reduce complexity to O(nlogn)

* Add TODO comment about performance

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: Dennis <dennis@kobert.dev>
This commit is contained in:
0HyperCube
2022-01-16 08:55:45 -08:00
committed by Keavon Chambers
co-authored by Keavon Chambers Dennis
parent bd3191f16e
commit adcd7cd9a3
4 changed files with 9 additions and 6 deletions
+2 -2
View File
@@ -114,11 +114,11 @@ impl Document {
// Return returns all folders that are not contained in any other of the given folders
pub fn shallowest_folders<'a>(&'a self, layers: impl Iterator<Item = &'a [LayerId]>) -> Vec<&[LayerId]> {
self.shallowest_unique_layers(self.folders(layers))
Self::shallowest_unique_layers(self.folders(layers))
}
// Return returns all layers that are not contained in any other of the given folders
pub fn shallowest_unique_layers<'a>(&'a self, layers: impl Iterator<Item = &'a [LayerId]>) -> Vec<&[LayerId]> {
pub fn shallowest_unique_layers<'a>(layers: impl Iterator<Item = &'a [LayerId]>) -> Vec<&'a [LayerId]> {
let mut sorted_layers: Vec<_> = layers.collect();
sorted_layers.sort();
// Sorting here creates groups of similar UUID paths