pub struct GroupNavigator {
pub root: ShdfGroup,
}Expand description
Navigate an ShdfGroup hierarchy using HDF5-style slash-separated paths.
§Example
let mut root = ShdfGroup::new("root");
let mut sim = ShdfGroup::new("simulation");
sim.add_dataset_f64("time", vec![3], vec![0.0, 0.5, 1.0]);
root.add_child(sim);
let nav = GroupNavigator::new(root);
assert!(nav.get_dataset("/simulation/time").is_some());Fields§
§root: ShdfGroupRoot group of the hierarchy.
Implementations§
Sourcepub fn get_dataset(&self, path: &str) -> Option<&Dataset>
pub fn get_dataset(&self, path: &str) -> Option<&Dataset>
Resolve a slash-separated path such as "/root/simulation/atoms/positions"
and return the terminal dataset if it exists.
The first path component must match the root group name.
Sourcepub fn all_paths(&self) -> Vec<String>
pub fn all_paths(&self) -> Vec<String>
Return all dataset paths reachable from the root, in DFS order.
Sourcepub fn total_datasets(&self) -> usize
pub fn total_datasets(&self) -> usize
Count total datasets reachable from the root.
Auto Trait Implementations§
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
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.