pub trait ValueProvider<'a, V>: Send + Sync {
    type ValueRef: Deref<Target = V>;
    type ValueMut: DerefMut<Target = V>;

    // Required methods
    fn get_value(&'a self, query: Query) -> Result<Self::ValueRef, GraphError>;
    fn mut_value(
        &'a mut self,
        query: Query
    ) -> Result<Self::ValueMut, GraphError>;

    // Provided method
    fn set_value(&'a mut self, query: Query, value: V) -> Result<V, GraphError> { ... }
}
Expand description

Extend the ability to get a value from a graph

Examples

use graph_theory::{entry_engines::ListStorage, EntryEngine, GraphEngine};

Required Associated Types§

source

type ValueRef: Deref<Target = V>

The reference type of [V].

Examples
use graph_theory::{entry_engines::ListStorage, EntryEngine, GraphEngine};
source

type ValueMut: DerefMut<Target = V>

The mutable reference type of [V].

Examples
use graph_theory::{entry_engines::ListStorage, EntryEngine, GraphEngine};

Required Methods§

source

fn get_value(&'a self, query: Query) -> Result<Self::ValueRef, GraphError>

Get the value reference from the graph by Query.

Examples
use graph_theory::{entry_engines::ListStorage, EntryEngine, GraphEngine};
source

fn mut_value(&'a mut self, query: Query) -> Result<Self::ValueMut, GraphError>

Get the mutable value reference from the graph by Query.

Examples
use graph_theory::{entry_engines::ListStorage, EntryEngine, GraphEngine};

Provided Methods§

source

fn set_value(&'a mut self, query: Query, value: V) -> Result<V, GraphError>

Set the owned value to the graph by Query, return the old value if it exists, return NotFound error missing this entry.

Examples
use graph_theory::{entry_engines::ListStorage, EntryEngine, GraphEngine};

Implementors§