pub struct PathMap { /* private fields */ }Expand description
Stores path sequences as lists of dynamic pool indices. Index 0 is reserved as null.
Implementations§
Source§impl PathMap
impl PathMap
pub fn new() -> Self
Sourcepub fn push(&mut self, indices: Vec<u16>) -> u16
pub fn push(&mut self, indices: Vec<u16>) -> u16
Appends a path (as dynamic pool indices) and returns its index.
§Examples
use state_engine::common::pool::PathMap;
let mut map = PathMap::new();
let idx = map.push(vec![1, 2, 3]);
assert_ne!(idx, 0);
assert_eq!(map.get(idx), Some([1u16, 2, 3].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 PathMap
impl RefUnwindSafe for PathMap
impl Send for PathMap
impl Sync for PathMap
impl Unpin for PathMap
impl UnsafeUnpin for PathMap
impl UnwindSafe for PathMap
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