pub enum GraphReference<'reference, 'graph> {
Gbz(&'reference GBZ),
Db(&'reference mut GraphInterface<'graph>),
None,
}Expand description
A reference to a GBZ-compatible graph.
Graph operations with a GBZ graph take an immutable reference to the graph.
The corresponding operations with GBZ-base using GraphInterface take a mutable reference instead.
This wrapper can be created on demand to encapsulate a reference to either type of graph.
Variants§
Gbz(&'reference GBZ)
A GBZ graph.
Db(&'reference mut GraphInterface<'graph>)
None
No graph provided.
Implementations§
Source§impl<'reference, 'graph> GraphReference<'reference, 'graph>
impl<'reference, 'graph> GraphReference<'reference, 'graph>
Sourcepub fn gbz_record(&mut self, handle: usize) -> Result<GBZRecord, String>
pub fn gbz_record(&mut self, handle: usize) -> Result<GBZRecord, String>
Returns the record for the oriented node corresponding to the given handle.
§Errors
Returns an error if the handle does not exist in the graph.
Returns an error if the graph reference is Self::None.
Passes through any errors from the graph implementation.
Sourcepub fn graph_name(&mut self) -> Result<GraphName, String>
pub fn graph_name(&mut self) -> Result<GraphName, String>
Returns the stable graph name (pggname) for the graph.
Returns an empty name if the graph reference is Self::None.
§Errors
Returns an empty object if the corresponding GBZ tags cannot be parsed. Passes through any errors from the graph implementation.
Sourcepub fn is_none(&self) -> bool
pub fn is_none(&self) -> bool
Returns true if the graph reference is Self::None.