pub struct ChildrenMap { /* private fields */ }Expand description
Stores child key index lists for nodes with multiple children. Index 0 is reserved as null.
Implementations§
Source§impl ChildrenMap
impl ChildrenMap
pub fn new() -> Self
Sourcepub fn push(&mut self, indices: Vec<u16>) -> u16
pub fn push(&mut self, indices: Vec<u16>) -> u16
Appends a children list (as key list indices) and returns its index.
§Examples
use state_engine::common::pool::ChildrenMap;
let mut map = ChildrenMap::new();
let idx = map.push(vec![2, 3, 4]);
assert_ne!(idx, 0);
assert_eq!(map.get(idx), Some([2u16, 3, 4].as_slice()));
assert_eq!(map.get(0), Some([].as_slice())); // null slot
assert_eq!(map.get(999), None);Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChildrenMap
impl RefUnwindSafe for ChildrenMap
impl Send for ChildrenMap
impl Sync for ChildrenMap
impl Unpin for ChildrenMap
impl UnsafeUnpin for ChildrenMap
impl UnwindSafe for ChildrenMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more