Commit graph

15 commits

Author SHA1 Message Date
janis 81f92738db
work on iterating 2025-09-17 18:06:36 +02:00
janis c2cecdf85f
copy+clone for handle 2025-09-17 14:04:37 +02:00
janis 5e1a4a245a
trie innit 2025-09-17 00:57:15 +02:00
janis 3e3b096174
refactor HandleOrTree to generic TreeOr type 2025-09-16 19:22:08 +02:00
janis 96e7045d5b
idk man.. 2025-09-16 19:02:13 +02:00
Janis 41f8763f18 refactor(tree): remove unused constants, debug prints, and imports
- Removed unused constants and redundant imports.
- Eliminated debug print statements from the `search` module.
- Added `#[allow(dead_code)]` annotations to suppress warnings for unused functions.
- Made `Tree` and `as_subtree_mut` public
2025-08-15 23:46:43 +02:00
Janis 9663e95210 refactor(tree): simplify NodeRef type by removing redundant parameters
- Removed the `Type` parameter from `NodeRef` and related structs and methods
2025-08-15 23:25:05 +02:00
Janis b11805aacd refactor(tree): simplify node structure and improve memory handling
- Replaced `InternalNode` with a unified `LeafNode` structure to simplify
  the node hierarchy and reduce redundancy.
- Introduced `capacity` field in `LeafNode` to dynamically manage keys
  and edges, replacing fixed-size arrays.
- Added methods for growing node capacity and handling dynamic memory
  allocation for keys and edges.
- Updated `NodeRef` methods to work with the new `LeafNode` structure,
  including safe handling of raw pointers and memory operations.
- Adjusted tests to reflect the new node structure and ensure correctness.
2025-08-15 23:01:04 +02:00
Janis affa52ba73 feat(tree): add mutable subtree access and traversal methods
- Introduced `into_value_mut` for mutable value access in `Handle`
- Added `into_subtree` for converting OccupiedEntries into mutable subtrees
- Refactored `SubtreeMut` into a generic `Subtree` supporting borrow types
- Implemented `get_subtree` and `get_subtree_mut` for subtree traversal
- Updated `Tree` to use the new `Subtree` abstraction
2025-08-11 22:43:34 +02:00
Janis ebd259d78c refactor(tree): simplify tree mutation and entry handling
- Introduced `SubtreeMut` for encapsulating mutable subtree operations
- Simplified `Tree::entry` by delegating to `SubtreeMut::entry`
- Removed redundant and commented-out code for clarity
- Added `Handle::value_mut` for mutable access to node values
2025-08-11 18:58:53 +02:00
Janis 2dd4697b29 refactor(tree): improve node handling and add tests for leaf promotion
- Refactored `InternalNode` initialization and parent-child relationships
  to improve clarity and safety.
- made `InternalNode` `repr(C)` because I was stupid
- Added `reparent` method to simplify node reparenting logic.
- Introduced `as_leaf_non_null` for safer leaf node handling.
- Updated test utilities to streamline insertion and debugging.
- Added a new test case `promote_leaf` to validate leaf promotion logic.
2025-08-08 21:52:01 +02:00
Janis e07e69a0c4 feat(tree): enhance tree structure with debug traits and new methods
- Add `Debug` implementations for tree-related structs and enums
- Introduce new methods for node manipulation, including `make_internal_node`
- Refactor `Tree::entry` to support key insertion and retrieval
- Improve internal node handling with enhanced parent-child link management
- Add test cases for tree operations and debug output
2025-08-08 20:57:02 +02:00
Janis b6c16f2739 feat(tree): enhance tree structure with new features and optimizations
- Added support for `maybe_uninit_slice` feature in `lib.rs`
- Introduced `Borrow` and `Ordering` imports in `tree.rs`
- Refactored marker structs and renamed `KV` to `Value`, `Immutable` to `Immut`
- Updated `LeafNode` to use `Option<MaybeUninit<V>>` for value storage
- Simplified `NodeRef` type parameters and added `Sync` and `Send` implementations
- Enhanced `Handle` with `new_value` method for value handling
- Added methods for parent link correction and child link management
- Implemented `search` module for tree traversal and key lookup
- Introduced `entry` module for managing vacant and occupied entries
- Added `DormantMutRef` utility for safe mutable reference reborrowing
2025-08-08 17:45:13 +02:00
Janis 10e762e730 invested actual thought into this 2025-08-08 01:08:06 +02:00
Janis 7939d6df47 copy from std::tree 2025-08-08 01:08:06 +02:00