My personal-knowledge-system, with deeply integrated task tracking and long term goal planning capabilities.
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: change sakura to tree

+93 -93
+9 -9
Cargo.lock
··· 4276 4276 checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" 4277 4277 4278 4278 [[package]] 4279 - name = "sakura" 4280 - version = "0.1.0" 4281 - dependencies = [ 4282 - "automerge", 4283 - "autosurgeon", 4284 - "serde", 4285 - ] 4286 - 4287 - [[package]] 4288 4279 name = "same-file" 4289 4280 version = "1.0.6" 4290 4281 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 5465 5456 "tracing", 5466 5457 "tracing-core", 5467 5458 "tracing-log", 5459 + ] 5460 + 5461 + [[package]] 5462 + name = "tree" 5463 + version = "0.1.0" 5464 + dependencies = [ 5465 + "automerge", 5466 + "autosurgeon", 5467 + "serde", 5468 5468 ] 5469 5469 5470 5470 [[package]]
+1 -1
Cargo.toml
··· 2 2 members = [ 3 3 "crates/db", 4 4 "crates/db/migration", 5 - "crates/sakura" 5 + "crates/tree" 6 6 ] 7 7 8 8
+1 -1
crates/sakura/Cargo.toml crates/tree/Cargo.toml
··· 1 1 [package] 2 - name = "sakura" 2 + name = "tree" 3 3 version = "0.1.0" 4 4 authors.workspace = true 5 5 edition.workspace = true
+19 -19
crates/sakura/src/behaviors.rs crates/tree/src/behaviors.rs
··· 8 8 /// be set as the first child as the new root `Node`. 9 9 /// 10 10 /// ``` 11 - /// use sakura::*; 12 - /// use sakura::InsertBehavior::*; 11 + /// use tree::*; 12 + /// use tree::InsertBehavior::*; 13 13 /// 14 14 /// let mut tree: Tree<i32> = Tree::new(); 15 15 /// let root_node = Node::new(1); ··· 27 27 /// `Result` containing the `NodeId` of the child that was added or a `NodeIdError` 28 28 /// 29 29 /// ``` 30 - /// use sakura::*; 31 - /// use sakura::InsertBehavior::*; 30 + /// use tree::*; 31 + /// use tree::InsertBehavior::*; 32 32 /// 33 33 /// let root_node = Node::new(1); 34 34 /// let child_node = Node::new(2); ··· 52 52 /// 53 53 /// 54 54 /// ``` 55 - /// use sakura::*; 56 - /// use sakura::InsertBehavior::*; 57 - /// use sakura::RemoveBehavior::*; 55 + /// use tree::*; 56 + /// use tree::InsertBehavior::*; 57 + /// use tree::RemoveBehavior::*; 58 58 /// 59 59 /// let mut tree: Tree<i32> = Tree::new(); 60 60 /// ··· 80 80 /// If `A` doesn't have a parent, then this behaves exactly like 81 81 /// `RemoveBehavior::OrphanChildren`. 82 82 /// ``` 83 - /// use sakura::*; 84 - /// use sakura::InsertBehavior::*; 85 - /// use sakura::RemoveBehavior::*; 83 + /// use tree::*; 84 + /// use tree::InsertBehavior::*; 85 + /// use tree::RemoveBehavior::*; 86 86 /// 87 87 /// let mut tree: Tree<i32> = Tree::new(); 88 88 /// ··· 106 106 /// `NodeId`'s. 107 107 /// 108 108 /// ``` 109 - /// use sakura::*; 110 - /// use sakura::InsertBehavior::*; 111 - /// use sakura::RemoveBehavior::*; 109 + /// use tree::*; 110 + /// use tree::InsertBehavior::*; 111 + /// use tree::RemoveBehavior::*; 112 112 /// 113 113 /// let mut tree: Tree<i32> = Tree::new(); 114 114 /// ··· 135 135 /// last child of the new root `Node`. 136 136 /// 137 137 /// ``` 138 - /// use sakura::*; 139 - /// use sakura::InsertBehavior::*; 140 - /// use sakura::MoveBehavior::*; 138 + /// use tree::*; 139 + /// use tree::InsertBehavior::*; 140 + /// use tree::MoveBehavior::*; 141 141 /// 142 142 /// let mut tree: Tree<i32> = Tree::new(); 143 143 /// ··· 167 167 /// NOTE: During the shift-up part of the above scenario, the `Node` being 168 168 /// shifted up will always be added as the last child of its new parent. 169 169 /// ``` 170 - /// use sakura::*; 171 - /// use sakura::InsertBehavior::*; 172 - /// use sakura::MoveBehavior::*; 170 + /// use tree::*; 171 + /// use tree::InsertBehavior::*; 172 + /// use tree::MoveBehavior::*; 173 173 /// 174 174 /// let mut tree: Tree<i32> = Tree::new(); 175 175 ///
crates/sakura/src/error.rs crates/tree/src/error.rs
crates/sakura/src/iterators.rs crates/tree/src/iterators.rs
crates/sakura/src/lib.rs crates/tree/src/lib.rs
+6 -6
crates/sakura/src/node.rs crates/tree/src/node.rs
··· 24 24 /// Creates a new `Node` with the provided data 25 25 /// 26 26 /// ``` 27 - /// use sakura::Node; 27 + /// use tree::Node; 28 28 /// 29 29 /// let _one: Node<i32> = Node::new(1); 30 30 /// ``` ··· 41 41 /// Returns a reference to the data inside the `Node` 42 42 /// 43 43 /// ``` 44 - /// use sakura::Node; 44 + /// use tree::Node; 45 45 /// 46 46 /// let x = 10; 47 47 /// let node: Node<i32> = Node::new(x); ··· 54 54 /// Returns a mutable reference to the data inside the `Node` 55 55 /// 56 56 /// ``` 57 - /// use sakura::Node; 57 + /// use tree::Node; 58 58 /// 59 59 /// let x = 10; 60 60 /// let mut node: Node<i32> = Node::new(x); ··· 69 69 /// Returns the data previously in the node 70 70 /// 71 71 /// ``` 72 - /// use sakura::Node; 72 + /// use tree::Node; 73 73 /// 74 74 /// let x = 10; 75 75 /// let mut y = 15; ··· 89 89 /// Returns the parent of this `Node`, if it has one. 90 90 /// 91 91 /// ``` 92 - /// use sakura::Node; 92 + /// use tree::Node; 93 93 /// 94 94 /// let node: Node<i32> = Node::new(1); 95 95 /// # assert_eq!(node.parent(), None); ··· 101 101 /// Returns the children of this `Node` 102 102 /// 103 103 /// ``` 104 - /// use sakura::Node; 104 + /// use tree::Node; 105 105 /// 106 106 /// let node: Node<i32> = Node::new(0); 107 107 /// # assert_eq!(node.children().len(), 0);
+57 -57
crates/sakura/src/tree.rs crates/tree/src/tree.rs
··· 26 26 /// Creates a new `TreeBuilder` with default settings. 27 27 /// 28 28 /// ``` 29 - /// use sakura::TreeBuilder; 29 + /// use tree::TreeBuilder; 30 30 /// 31 31 /// let _tree_builder: TreeBuilder<i32> = TreeBuilder::new(); 32 32 /// ··· 44 44 /// Sets the root `Node` for the resulting `Tree` from this `TreeBuilder`. 45 45 /// 46 46 /// ``` 47 - /// use sakura::TreeBuilder; 48 - /// use sakura::Node; 47 + /// use tree::TreeBuilder; 48 + /// use tree::Node; 49 49 /// 50 50 /// let _tree_builder: TreeBuilder<i32> = TreeBuilder::new().with_root(Node::new(1)); 51 51 /// ``` ··· 66 66 /// that your `Tree` will **contain** at **any given time**._ 67 67 /// 68 68 /// ``` 69 - /// use sakura::TreeBuilder; 69 + /// use tree::TreeBuilder; 70 70 /// 71 71 /// let _tree_builder: TreeBuilder<i32> = TreeBuilder::new().with_node_capacity(1); 72 72 /// ··· 105 105 /// The maximum amount of nodes that have been removed at any given time is **3**. 106 106 /// 107 107 /// ``` 108 - /// use sakura::TreeBuilder; 108 + /// use tree::TreeBuilder; 109 109 /// 110 110 /// let _tree_builder: TreeBuilder<i32> = TreeBuilder::new().with_node_capacity(1); 111 111 /// ··· 121 121 /// Build a `Tree` based upon the current settings in the `TreeBuilder`. 122 122 /// 123 123 /// ``` 124 - /// use sakura::TreeBuilder; 125 - /// use sakura::Tree; 126 - /// use sakura::Node; 124 + /// use tree::TreeBuilder; 125 + /// use tree::Tree; 126 + /// use tree::Node; 127 127 /// 128 128 /// let _tree: Tree<i32> = TreeBuilder::new() 129 129 /// .with_root(Node::new(5)) ··· 154 154 /// 155 155 /// # Panics 156 156 /// Any function that takes a `NodeId` can `panic`, but this should 157 - /// only happen with improper `NodeId` management within `Sakura`, and 157 + /// only happen with improper `NodeId` management within `tree`, and 158 158 /// should have nothing to do with library user's code. 159 159 #[derive(Debug, Serialize, Deserialize, Reconcile, Hydrate)] 160 160 pub struct Tree<T> { ··· 209 209 /// Creates a new `Tree` with default settings (no root `Node` and no space pre-allocation) 210 210 /// 211 211 /// ``` 212 - /// use sakura::Tree; 212 + /// use tree::Tree; 213 213 /// 214 214 /// let _tree: Tree<i32> = Tree::new(); 215 215 /// ``` ··· 231 231 /// it exists. Otherwise, a `None` is returned. 232 232 /// 233 233 /// ``` 234 - /// use sakura::*; 235 - /// use sakura::InsertBehavior::*; 234 + /// use tree::*; 235 + /// use tree::InsertBehavior::*; 236 236 /// 237 237 /// let mut tree: Tree<i32> = Tree::new(); 238 238 /// let root_id = tree.insert(Node::new(5), AsRoot).unwrap(); ··· 248 248 /// Returns the maximum height of the `Tree`. 249 249 /// 250 250 /// ``` 251 - /// use sakura::*; 252 - /// use sakura::InsertBehavior::*; 251 + /// use tree::*; 252 + /// use tree::InsertBehavior::*; 253 253 /// 254 254 /// let mut tree: Tree<i32> = Tree::new(); 255 255 /// # assert_eq!(0, tree.height()); ··· 285 285 /// # Panics 286 286 /// 287 287 /// Can panic if the `NodeId` does not exist in the `Tree`, but this would 288 - /// be a bug in `Sakura` 288 + /// be a bug in `tree` 289 289 /// 290 290 /// ``` 291 - /// use sakura::*; 292 - /// use sakura::InsertBehavior::*; 291 + /// use tree::*; 292 + /// use tree::InsertBehavior::*; 293 293 /// 294 294 /// let mut tree: Tree<i32> = Tree::new(); 295 295 /// let root_id = tree.insert(Node::new(5), AsRoot).unwrap(); ··· 324 324 /// # Panics 325 325 /// 326 326 /// Can panic if the `NodeId` does not exist in the `Tree`, but this would 327 - /// be a bug in `Sakura` 327 + /// be a bug in `tree` 328 328 /// 329 329 /// ``` 330 - /// use sakura::*; 331 - /// use sakura::InsertBehavior::*; 330 + /// use tree::*; 331 + /// use tree::InsertBehavior::*; 332 332 /// 333 333 /// let mut tree: Tree<i32> = Tree::new(); 334 334 /// let root_id = tree.insert(Node::new(5), AsRoot).unwrap(); ··· 363 363 /// # Panics 364 364 /// 365 365 /// Can panic if the `NodeId` does not exist in the `Tree`, but this would 366 - /// be a bug in `Sakura` 366 + /// be a bug in `tree` 367 367 /// 368 368 /// ``` 369 - /// use sakura::*; 370 - /// use sakura::InsertBehavior::*; 369 + /// use tree::*; 370 + /// use tree::InsertBehavior::*; 371 371 /// 372 372 /// let root_node = Node::new(1); 373 373 /// let child_node = Node::new(2); ··· 401 401 /// # Panics 402 402 /// 403 403 /// Can panic if the `NodeId` does not exist in the `Tree`, but this would 404 - /// be a bug in `Sakura` 404 + /// be a bug in `tree` 405 405 /// 406 406 /// 407 407 /// ``` 408 - /// use sakura::*; 409 - /// use sakura::InsertBehavior::*; 410 - /// use sakura::RemoveBehavior::*; 408 + /// use tree::*; 409 + /// use tree::InsertBehavior::*; 410 + /// use tree::RemoveBehavior::*; 411 411 /// 412 412 /// let mut tree: Tree<i32> = Tree::new(); 413 413 /// let root_id = tree.insert(Node::new(0), AsRoot).unwrap(); ··· 489 489 /// # Panics 490 490 /// 491 491 /// Can panic if the `NodeId` does not exist in the `Tree`, but this would 492 - /// be a bug in `Sakura` 492 + /// be a bug in `tree` 493 493 /// 494 494 #[allow(clippy::needless_pass_by_value)] 495 495 pub fn move_node( ··· 582 582 /// # Panics 583 583 /// 584 584 /// Can panic if the `NodeId` does not exist in the `Tree`, but this would 585 - /// be a bug in `Sakura` 585 + /// be a bug in `tree` 586 586 /// 587 587 /// ``` 588 - /// use sakura::*; 589 - /// use sakura::InsertBehavior::*; 588 + /// use tree::*; 589 + /// use tree::InsertBehavior::*; 590 590 /// 591 591 /// let mut tree: Tree<i32> = Tree::new(); 592 592 /// ··· 644 644 /// # Panics 645 645 /// 646 646 /// Can panic if the `NodeId` does not exist in the `Tree`, but this would 647 - /// be a bug in `Sakura` 647 + /// be a bug in `tree` 648 648 /// 649 649 /// ``` 650 - /// use sakura::*; 651 - /// use sakura::InsertBehavior::*; 650 + /// use tree::*; 651 + /// use tree::InsertBehavior::*; 652 652 /// 653 653 /// let mut tree: Tree<i32> = Tree::new(); 654 654 /// ··· 696 696 /// # Panics 697 697 /// 698 698 /// Can panic if the `NodeId` does not exist in the `Tree`, but this would 699 - /// be a bug in `Sakura` 699 + /// be a bug in `tree` 700 700 /// 701 701 /// ``` 702 - /// use sakura::*; 703 - /// use sakura::InsertBehavior::*; 702 + /// use tree::*; 703 + /// use tree::InsertBehavior::*; 704 704 /// 705 705 /// let mut tree: Tree<i32> = Tree::new(); 706 706 /// let root_id = tree.insert(Node::new(0), AsRoot).unwrap(); ··· 726 726 /// # Panics 727 727 /// 728 728 /// Can panic if the `NodeId` does not exist in the `Tree`, but this would 729 - /// be a bug in `Sakura` 729 + /// be a bug in `tree` 730 730 /// 731 731 /// 732 732 /// ``` 733 - /// use sakura::*; 734 - /// use sakura::InsertBehavior::*; 733 + /// use tree::*; 734 + /// use tree::InsertBehavior::*; 735 735 /// 736 736 /// let mut tree: Tree<i32> = Tree::new(); 737 737 /// let root_id = tree.insert(Node::new(0), AsRoot).unwrap(); ··· 758 758 /// # Panics 759 759 /// 760 760 /// Can panic if the `NodeId` does not exist in the `Tree`, but this would 761 - /// be a bug in `Sakura` 761 + /// be a bug in `tree` 762 762 /// 763 763 /// ``` 764 - /// use sakura::*; 765 - /// use sakura::InsertBehavior::*; 764 + /// use tree::*; 765 + /// use tree::InsertBehavior::*; 766 766 /// 767 767 /// let mut tree: Tree<i32> = Tree::new(); 768 768 /// let root_id = tree.insert(Node::new(0), AsRoot).unwrap(); ··· 787 787 /// # Panics 788 788 /// 789 789 /// Can panic if the `NodeId` does not exist in the `Tree`, but this would 790 - /// be a bug in `Sakura` 790 + /// be a bug in `tree` 791 791 /// 792 792 /// ``` 793 - /// use sakura::*; 794 - /// use sakura::InsertBehavior::*; 793 + /// use tree::*; 794 + /// use tree::InsertBehavior::*; 795 795 /// 796 796 /// let mut tree: Tree<i32> = Tree::new(); 797 797 /// let root_id = tree.insert(Node::new(0), AsRoot).unwrap(); ··· 816 816 /// # Panics 817 817 /// 818 818 /// Can panic if the `NodeId` does not exist in the `Tree`, but this would 819 - /// be a bug in `Sakura` 819 + /// be a bug in `tree` 820 820 /// 821 821 /// ``` 822 - /// use sakura::*; 823 - /// use sakura::InsertBehavior::*; 822 + /// use tree::*; 823 + /// use tree::InsertBehavior::*; 824 824 /// 825 825 /// let mut tree: Tree<i32> = Tree::new(); 826 826 /// let root_id = tree.insert(Node::new(0), AsRoot).unwrap(); ··· 851 851 /// # Panics 852 852 /// 853 853 /// Can panic if the `NodeId` does not exist in the `Tree`, but this would 854 - /// be a bug in `Sakura` 854 + /// be a bug in `tree` 855 855 /// 856 856 /// ``` 857 - /// use sakura::*; 858 - /// use sakura::InsertBehavior::*; 857 + /// use tree::*; 858 + /// use tree::InsertBehavior::*; 859 859 /// 860 860 /// let mut tree: Tree<i32> = Tree::new(); 861 861 /// let root_id = tree.insert(Node::new(0), AsRoot).unwrap(); ··· 971 971 assert!( 972 972 idx <= self.nodes.len(), 973 973 "NodeId: {node_id:?} is out of bounds. This is a bug inside 974 - Sakura.", 974 + tree.", 975 975 ); 976 976 977 977 if self.nodes.get(idx).is_none() { ··· 1063 1063 /// Function can error if something goes wrong during debug! 1064 1064 /// 1065 1065 /// ``` 1066 - /// use sakura::Tree; 1067 - /// use sakura::Node; 1068 - /// use sakura::InsertBehavior::*; 1066 + /// use tree::Tree; 1067 + /// use tree::Node; 1068 + /// use tree::InsertBehavior::*; 1069 1069 /// 1070 1070 /// let mut tree = Tree::<i32>::new(); 1071 1071 /// let root_id = tree.insert(Node::new(0), AsRoot).unwrap(); ··· 1085 1085 /// Writes nothing if the tree is empty. 1086 1086 /// 1087 1087 /// ``` 1088 - /// use sakura::Tree; 1088 + /// use tree::Tree; 1089 1089 /// 1090 1090 /// let tree = Tree::<i32>::new(); 1091 1091 /// let mut s = String::new();