[−][src]Trait sophia::term::index_map::TermIndexMap
A bidirectionnal mapping between Term
s and indexes of a smaller type.
The TermIndexMap maintains a reference count for each index, to automatically free them whenever they are not used.
One special index (called the null index) is never mapped to any Term
,
and is used to represent None
(the absence of graph name in a Quad
).
Associated Types
type Index: Copy + Eq
The type used to represent terms
type Factory: TermFactory
The factory used to instantiate terms.
Associated Constants
const NULL_INDEX: Self::Index
Required methods
fn get_index(&self, t: &RefTerm) -> Option<Self::Index>
Return the index associated to the given term, if it exists.
fn make_index(&mut self, t: &RefTerm) -> Self::Index
Return the index associated to the given term, creating it if required, and increasing its ref count.
fn get_term(&self, i: Self::Index) -> Option<&FTerm<Self::Factory>>
Return the term associated to the given index, if it exists.
fn inc_ref(&mut self, i: Self::Index)
Increase the reference count of a given index (or do nothing if i is the null index).
fn dec_ref(&mut self, i: Self::Index)
Decrease the reference count of a given index (or do nothing if i is the null index).
fn shrink_to_fit(&mut self)
Shrinks the capacity of the TermIndexMap as much as possible.
Provided methods
fn get_index_for_graph_name(&self, g: Option<&RefTerm>) -> Option<Self::Index>
Return the index associated to the given graph name, if it exists.
fn make_index_for_graph_name(&mut self, g: Option<&RefTerm>) -> Self::Index
Return the index associated to the given graph name, creating it if required, and increasing its ref count.
fn get_graph_name(
&self,
i: Self::Index
) -> Option<Option<&FTerm<Self::Factory>>>
&self,
i: Self::Index
) -> Option<Option<&FTerm<Self::Factory>>>
Return the graph name associated to the given index, if it exists.
NB: a graph name is already an Option
, None
meaning the (unnamed) default graph.
As a consequence, this methods returns an option of option :
None
means that given index is not associated to any graph name,Some(None)
means that the given index is associated to the default graph,Some(Some(term))
means that given index is associetd to a proper graph name.
Implementors
impl<T, F> TermIndexMap for TermIndexMapU<T, F> where
T: Unsigned,
F: TermFactory + Default,
[src]
T: Unsigned,
F: TermFactory + Default,
This macro implements TermIndexMap for TermIndexMapU