Skip to main content

ImmutableWeave

Trait ImmutableWeave 

Source
pub trait ImmutableWeave<K, N, T>
where K: Hash + Copy + Eq + Ord, N: Node<K, T>,
{ type Nodes; type Roots; // Required methods fn len(&self) -> usize; fn is_empty(&self) -> bool; fn nodes(&self) -> &Self::Nodes; fn roots(&self) -> &Self::Roots; fn contains(&self, id: &K) -> bool; fn contains_active(&self, id: &K) -> bool; fn get_node(&self, id: &K) -> Option<&N>; fn get_ordered_node_identifiers(&self, output: &mut Vec<K>); fn get_ordered_node_identifiers_from(&self, id: &K, output: &mut Vec<K>); fn get_active_path(&self, output: &mut Vec<K>); fn get_path_from(&self, id: &K, output: &mut Vec<K>); }
Expand description

A read-only Weave.

Required Associated Types§

Source

type Nodes

Mapping between identifiers and nodes.

Source

type Roots

Identifiers of “root” nodes (nodes which do not have any parents).

Required Methods§

Source

fn len(&self) -> usize

Returns the number of nodes stored within the Weave.

Source

fn is_empty(&self) -> bool

Returns true if the Weave does not contain any nodes.

Source

fn nodes(&self) -> &Self::Nodes

Returns a reference to the identifier:node mapping.

Source

fn roots(&self) -> &Self::Roots

Returns a reference to the identifiers of “root” nodes (nodes which do not have any parents).

Source

fn contains(&self, id: &K) -> bool

Returns true if the Weave contains a node with the specified identifier.

Source

fn contains_active(&self, id: &K) -> bool

Returns true if the Weave contains an “active” node (node.is_active() == true) with the specified identifier.

The meaning of this value can depend on the underlying Weave implementation.

Source

fn get_node(&self, id: &K) -> Option<&N>

Returns a reference to the node corresponding to the identifier.

Source

fn get_ordered_node_identifiers(&self, output: &mut Vec<K>)

Builds a list of all node identifiers ordered by their positions in the Weave.

Source

fn get_ordered_node_identifiers_from(&self, id: &K, output: &mut Vec<K>)

Recursively builds a list of all children of the specified node ordered by their positions in the Weave.

Source

fn get_active_path(&self, output: &mut Vec<K>)

Builds the longest contiguous path of active nodes which ends at a root node.

Source

fn get_path_from(&self, id: &K, output: &mut Vec<K>)

Builds a path through the Weave starting at the specified node and ending at a root node.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<K, T, M, S> ImmutableWeave<<K as Archive>::Archived, ArchivedDependentNode<K, T, S>, <T as Archive>::Archived> for ArchivedDependentWeave<K, T, M, S>
where K: Archive + Hash + Copy + Eq + Ord, <K as Archive>::Archived: Hash + Copy + Eq + Ord + 'static, T: Archive, M: Archive, S: BuildHasher + Default + Clone,

Available on crate feature rkyv only.
Source§

impl<K, T, M, S> ImmutableWeave<<K as Archive>::Archived, ArchivedIndependentNode<K, T, S>, <T as Archive>::Archived> for ArchivedIndependentWeave<K, T, M, S>
where K: Archive + Hash + Copy + Eq + Ord, <K as Archive>::Archived: Hash + Copy + Eq + Ord + 'static, T: Archive + IndependentContents, M: Archive, S: BuildHasher + Default + Clone,

Available on crate feature rkyv only.