Created
June 5, 2020 13:18
-
-
Save BruJu/6344dfa0229173be66fec2ce75a44fa5 to your computer and use it in GitHub Desktop.
TreedDataset - new with same indexes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// At the moment, this code feels bad to write and seems unnecessary | |
// but it may not be that bad so I keep it here | |
// https://github.com/BruJu/Portable-Reasoning-in-Web-Assembly | |
// https://github.com/BruJu/WasmTreeDataset | |
impl TreedDataset { | |
pub fn new_with_same_indexes(&self) -> Self { | |
let base_index = vec!(self.base_tree.0.clone()); | |
let optional_indexes = { | |
let mut vec = vec!(); | |
for optional in (&self.optional_trees).into_iter() { | |
vec.push(optional.0); | |
} | |
vec | |
}; | |
TreedDataset::new_with_blocks(base_index, optional_indexes) | |
// To copy the elements | |
// new_tree.base_tree.1 = (&self.base_tree.1).into_iter().map(|element| element.clone()).collect(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is probably a way to improve the data structure. I think the block / block order abstraction is nice to hide the quad terms reordering but the way the TreedDataset manipulates the subtrees is weird.