pub struct NodeMapGraph<T, B> { /* private fields */ }Expand description
Nodes of a single graph within a node map.
Nodes are stored in declaration order; see NodeMap.
Implementations§
Source§impl<T, B> NodeMapGraph<T, B>
impl<T, B> NodeMapGraph<T, B>
Source§impl<T: Eq + Hash, B: Eq + Hash> NodeMapGraph<T, B>
impl<T: Eq + Hash, B: Eq + Hash> NodeMapGraph<T, B>
Sourcepub fn contains(&self, id: &Id<T, B>) -> bool
pub fn contains(&self, id: &Id<T, B>) -> bool
Checks whether the graph declares a node with the given identifier.
Sourcepub fn get(&self, id: &Id<T, B>) -> Option<&IndexedNode<T, B>>
pub fn get(&self, id: &Id<T, B>) -> Option<&IndexedNode<T, B>>
Returns the value bound to the given key, if any.
Sourcepub fn get_mut(&mut self, id: &Id<T, B>) -> Option<&mut IndexedNode<T, B>>
pub fn get_mut(&mut self, id: &Id<T, B>) -> Option<&mut IndexedNode<T, B>>
Returns a mutable reference to the value bound to the given key, if any.
Sourcepub fn declare_node(
&mut self,
id: Id<T, B>,
index: Option<&str>,
) -> DeclareNodeResult<'_, T, B>
pub fn declare_node( &mut self, id: Id<T, B>, index: Option<&str>, ) -> DeclareNodeResult<'_, T, B>
Declares a node in this graph, failing if index contradicts the index
already recorded for it.
§Errors
Returns an error when the node is already declared with a conflicting index, or when the generator runs out of identifiers.
Sourcepub fn merge_with(&mut self, other: Self)
pub fn merge_with(&mut self, other: Self)
Merges other into this graph.
This calls merge_node with every node of other.
Sourcepub fn merge_node(&mut self, node: IndexedNode<T, B>)
pub fn merge_node(&mut self, node: IndexedNode<T, B>)
Merges the given node into the graph.
The node must have an identifier, or this function has no effect.
If there is already a node with the same identifier:
- The index of
node, if any, overrides the previously existing index. - The list of
nodetypes is concatenated after the preexisting types. - The graph and imported values are overridden.
- Properties and reverse properties are merged.
Sourcepub fn nodes(&self) -> NodeMapGraphNodes<'_, T, B>
pub fn nodes(&self) -> NodeMapGraphNodes<'_, T, B>
Returns an iterator over the nodes of the graph, in declaration order.
Sourcepub fn into_nodes(self) -> IntoNodeMapGraphNodes<T, B>
pub fn into_nodes(self) -> IntoNodeMapGraphNodes<T, B>
Consumes the graph, returning an iterator over its nodes in declaration order.
Source§impl<T, B> NodeMapGraph<T, B>
impl<T, B> NodeMapGraph<T, B>
Trait Implementations§
Source§impl<T, B> Default for NodeMapGraph<T, B>
impl<T, B> Default for NodeMapGraph<T, B>
Source§impl<T, B> IntoIterator for NodeMapGraph<T, B>
impl<T, B> IntoIterator for NodeMapGraph<T, B>
Source§impl<'a, T, B> IntoIterator for &'a NodeMapGraph<T, B>
impl<'a, T, B> IntoIterator for &'a NodeMapGraph<T, B>
Auto Trait Implementations§
impl<T, B> Freeze for NodeMapGraph<T, B>
impl<T, B> RefUnwindSafe for NodeMapGraph<T, B>
impl<T, B> Send for NodeMapGraph<T, B>
impl<T, B> Sync for NodeMapGraph<T, B>
impl<T, B> Unpin for NodeMapGraph<T, B>
impl<T, B> UnsafeUnpin for NodeMapGraph<T, B>
impl<T, B> UnwindSafe for NodeMapGraph<T, B>
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
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
Source§fn as_unordered(&self) -> &Unordered<T>
fn as_unordered(&self) -> &Unordered<T>
Unordered reference.