[][src]Trait sophia::graph::indexed::IndexedGraph

pub trait IndexedGraph {
    type Index: Copy + Eq + Hash;
    type TermData: TermData + 'static;
    fn with_capacity(capacity: usize) -> Self;
fn shrink_to_fit(&mut self);
fn get_index<T: ?Sized>(&self, t: &T) -> Option<Self::Index>
    where
        T: TTerm
;
fn get_term(&self, i: Self::Index) -> Option<&Term<Self::TermData>>;
fn insert_indexed<TS: ?Sized, TP: ?Sized, TO: ?Sized>(
        &mut self,
        s: &TS,
        p: &TP,
        o: &TO
    ) -> Option<[Self::Index; 3]>
    where
        TS: TTerm,
        TP: TTerm,
        TO: TTerm
;
fn remove_indexed<TS: ?Sized, TP: ?Sized, TO: ?Sized>(
        &mut self,
        s: &TS,
        p: &TP,
        o: &TO
    ) -> Option<[Self::Index; 3]>
    where
        TS: TTerm,
        TP: TTerm,
        TO: TTerm
; }

A utility trait for implementing Graph and MutableGraph based on an internal TermIndexMap for efficient storage.

The impl_mutable_graph_for_indexed_graph! macro can be used to derive the MutableGraph implementation for any implementation of IndexedGraph.

Associated Types

type Index: Copy + Eq + Hash

The type used to represent terms internally.

type TermData: TermData + 'static

Loading content...

Required methods

fn with_capacity(capacity: usize) -> Self

Construct a new empty graph, provisioning for storing capacity triples.

fn shrink_to_fit(&mut self)

Shrink the memory consumption of the graph as much as possible.

fn get_index<T: ?Sized>(&self, t: &T) -> Option<Self::Index> where
    T: TTerm

Return the index for the given term, if it exists.

fn get_term(&self, i: Self::Index) -> Option<&Term<Self::TermData>>

Return the term for the given index, if it exists.

fn insert_indexed<TS: ?Sized, TP: ?Sized, TO: ?Sized>(
    &mut self,
    s: &TS,
    p: &TP,
    o: &TO
) -> Option<[Self::Index; 3]> where
    TS: TTerm,
    TP: TTerm,
    TO: TTerm

Insert a triple in this Graph, and return the corresponding tuple of indices.

fn remove_indexed<TS: ?Sized, TP: ?Sized, TO: ?Sized>(
    &mut self,
    s: &TS,
    p: &TP,
    o: &TO
) -> Option<[Self::Index; 3]> where
    TS: TTerm,
    TP: TTerm,
    TO: TTerm

Remove a triple from this Graph, and return the corresponding tuple of indices.

Loading content...

Implementors

impl<I> IndexedGraph for HashGraph<I> where
    I: TermIndexMap,
    I::Index: Hash,
    <I::Factory as TermFactory>::TermData: 'static, 
[src]

type Index = I::Index

type TermData = <I::Factory as TermFactory>::TermData

impl<T> IndexedGraph for OpsWrapper<T> where
    T: IndexedGraph + Graph<Triple = ByTermRefs<Term<<T as IndexedGraph>::TermData>>>, 
[src]

type Index = T::Index

type TermData = T::TermData

impl<T> IndexedGraph for SpoWrapper<T> where
    T: IndexedGraph + Graph<Triple = ByTermRefs<Term<<T as IndexedGraph>::TermData>>>, 
[src]

type Index = T::Index

type TermData = T::TermData

Loading content...