pub struct PathGraph<V> { /* private fields */ }Implementations§
Source§impl<V> PathGraph<V>
impl<V> PathGraph<V>
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/simple.rs (line 4)
3fn main() {
4 let mut map = PathGraph::new();
5
6 map.insert(&[0], 1);
7 map.insert(&[1], 2);
8 map.insert(&[2], 3);
9
10 map.insert(&[0, 0], 4);
11 map.insert(&[0, 1], 5);
12 map.insert(&[0, 1, 0], 6);
13 map.insert(&[0, 1, 0], 7);
14 map.remove(&[0, 1, 0]);
15 map.insert(&[0, 1, 0], 7);
16
17 println!("{map:#?}");
18}Sourcepub fn insert(&mut self, path: &[u32], value: V)
pub fn insert(&mut self, path: &[u32], value: V)
Examples found in repository?
examples/simple.rs (line 6)
3fn main() {
4 let mut map = PathGraph::new();
5
6 map.insert(&[0], 1);
7 map.insert(&[1], 2);
8 map.insert(&[2], 3);
9
10 map.insert(&[0, 0], 4);
11 map.insert(&[0, 1], 5);
12 map.insert(&[0, 1, 0], 6);
13 map.insert(&[0, 1, 0], 7);
14 map.remove(&[0, 1, 0]);
15 map.insert(&[0, 1, 0], 7);
16
17 println!("{map:#?}");
18}pub fn insert_entry(&mut self, path: &[u32], entry: PathGraphEntry<V>)
Sourcepub fn remove(&mut self, path: &[u32]) -> Option<PathGraphEntry<V>>
pub fn remove(&mut self, path: &[u32]) -> Option<PathGraphEntry<V>>
Examples found in repository?
examples/simple.rs (line 14)
3fn main() {
4 let mut map = PathGraph::new();
5
6 map.insert(&[0], 1);
7 map.insert(&[1], 2);
8 map.insert(&[2], 3);
9
10 map.insert(&[0, 0], 4);
11 map.insert(&[0, 1], 5);
12 map.insert(&[0, 1, 0], 6);
13 map.insert(&[0, 1, 0], 7);
14 map.remove(&[0, 1, 0]);
15 map.insert(&[0, 1, 0], 7);
16
17 println!("{map:#?}");
18}pub fn find_path(&self, finder: impl Fn(Option<&V>) -> bool) -> Option<Vec<u32>>
pub fn find(&self, finder: impl Fn(Option<&V>) -> bool) -> Option<&V>
pub fn reduce<A>( &self, acc: &mut A, reducer: impl Fn(Option<&V>, &[u32], &mut A) -> bool, ) -> bool
pub fn find_child_path( &self, target: &[u32], finder: impl Fn(Option<&V>) -> bool, ) -> Option<Vec<u32>>
pub fn len(&self, path: &[u32]) -> Option<usize>
pub fn get(&self, path: &[u32]) -> Option<&V>
pub fn size(&self) -> usize
pub fn traverse(&self, target: &[u32], traverser: impl FnMut(&[u32], &V))
pub fn retain( &mut self, target: &[u32], retainer: impl FnMut(&[u32], &V) -> bool, traverser: impl FnMut(&[u32], &V), )
pub fn traverse_1_level( &self, target: &[u32], traverser: impl FnMut(&[u32], &V), )
Trait Implementations§
Auto Trait Implementations§
impl<V> Freeze for PathGraph<V>where
V: Freeze,
impl<V> RefUnwindSafe for PathGraph<V>where
V: RefUnwindSafe,
impl<V> Send for PathGraph<V>where
V: Send,
impl<V> Sync for PathGraph<V>where
V: Sync,
impl<V> Unpin for PathGraph<V>where
V: Unpin,
impl<V> UnsafeUnpin for PathGraph<V>where
V: UnsafeUnpin,
impl<V> UnwindSafe for PathGraph<V>where
V: UnwindSafe,
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