pub struct TypedGraph<NK, EK, S: SchemaExt<NK, EK>>{ /* private fields */ }
Implementations§
Source§impl<NK: Key, EK: Key, NT: GenericTypeIdentifier, ET: GenericTypeIdentifier> TypedGraph<NK, EK, GenericSchema<NT, ET>>
impl<NK: Key, EK: Key, NT: GenericTypeIdentifier, ET: GenericTypeIdentifier> TypedGraph<NK, EK, GenericSchema<NT, ET>>
pub fn assert_eq(&self, other: &Self) -> GenericResult<(), NK, EK, NT, ET>
Source§impl<NK, EK, S> TypedGraph<NK, EK, S>
impl<NK, EK, S> TypedGraph<NK, EK, S>
pub fn new(schema: S) -> Self
pub fn get_schema(&self) -> &S
pub fn node_count(&self) -> usize
pub fn edge_count(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get_node_safe(&self, node_id: NK) -> Option<&S::N>
pub fn get_node_safe_mut(&mut self, node_id: NK) -> Option<&mut S::N>
pub fn get_edge_safe(&self, edge_id: EK) -> Option<&S::E>
pub fn get_edge_safe_mut(&mut self, edge_id: EK) -> Option<&mut S::E>
pub fn get_node(&self, node_id: NK) -> SchemaResult<&S::N, NK, EK, S>
pub fn get_edge(&self, edge_id: EK) -> SchemaResult<&S::E, NK, EK, S>
pub fn get_edge_full( &self, edge_id: EK, ) -> SchemaResult<EdgeRef<'_, NK, EK, S>, NK, EK, S>
pub fn get_edge_full_mut( &mut self, edge_id: EK, ) -> SchemaResult<EdgeRefMut<'_, NK, EK, S>, NK, EK, S>
pub fn get_node_mut( &mut self, node_id: NK, ) -> SchemaResult<&mut S::N, NK, EK, S>
pub fn get_edge_mut( &mut self, edge_id: EK, ) -> SchemaResult<&mut S::E, NK, EK, S>
pub fn get_node_downcast<'a: 'b, 'b, N: 'b>( &'a self, node_id: NK, ) -> SchemaResult<N, NK, EK, S>
pub fn get_node_downcast_mut<'a: 'b, 'b, N: 'b>(
&'a mut self,
node_id: NK,
) -> SchemaResult<N, NK, EK, S>where
S::N: DowncastMut<'b, NK, EK, N, S>,
pub fn get_edge_downcast<'a: 'b, 'b, E: 'b>( &'a self, edge_id: EK, ) -> SchemaResult<E, NK, EK, S>
pub fn get_edge_downcast_mut<'a: 'b, 'b, E: 'b>(
&'a mut self,
edge_id: EK,
) -> SchemaResult<E, NK, EK, S>where
S::E: DowncastMut<'b, NK, EK, E, S>,
pub fn has_node(&self, node_id: NK) -> bool
pub fn has_edge(&self, edge_id: EK) -> bool
Sourcepub fn move_edge_order(
&mut self,
source_id: EK,
target_id: EK,
insert_position: InsertPosition,
) -> SchemaResult<(), NK, EK, S>
pub fn move_edge_order( &mut self, source_id: EK, target_id: EK, insert_position: InsertPosition, ) -> SchemaResult<(), NK, EK, S>
Reorder the outgoing edge order by inserting the source edge and shifting all other edges
This will fail if both edges do not have the same source node
InsertPosition::Before the source edge will have the same index as the target edge currently has InsertPosition::After the source edge will be placed at target_idx + 1 instead
pub fn add_node<N>(&mut self, node: N) -> SchemaResult<NK, NK, EK, S>
Sourcepub fn update_node<N>(&mut self, node: N) -> SchemaResult<NK, NK, EK, S>
pub fn update_node<N>(&mut self, node: N) -> SchemaResult<NK, NK, EK, S>
Add a node or update an existing one Updating a node is only allowed if all the connected edges allows for the new type
pub fn can_add_edges( &self, source_node: &S::N, target_node: &S::N, weight: &S::E, ) -> SchemaResult<Result<(), DisAllowedEdge>, NK, EK, S>
pub fn add_edge<E>( &mut self, source: NK, target: NK, edge: E, ) -> SchemaResult<EK, NK, EK, S>
Sourcepub fn update_edge<E>(
&mut self,
source: NK,
target: NK,
edge: E,
) -> SchemaResult<EK, NK, EK, S>
pub fn update_edge<E>( &mut self, source: NK, target: NK, edge: E, ) -> SchemaResult<EK, NK, EK, S>
Add or update the weight and enpoints of an edge The edge will preserve the order of endpoints that does not change
Sourcepub fn remove_node(&mut self, node_id: NK) -> SchemaResult<S::N, NK, EK, S>
pub fn remove_node(&mut self, node_id: NK) -> SchemaResult<S::N, NK, EK, S>
Remove a node and all edges to and from it
Sourcepub fn remove_edge(&mut self, edge_id: EK) -> SchemaResult<S::E, NK, EK, S>
pub fn remove_edge(&mut self, edge_id: EK) -> SchemaResult<S::E, NK, EK, S>
Remove an edge.
Sourcepub fn get_incoming<'a>(
&'a self,
node_id: NK,
) -> SchemaResult<impl Iterator<Item = EdgeRef<'a, NK, EK, S>>, NK, EK, S>
pub fn get_incoming<'a>( &'a self, node_id: NK, ) -> SchemaResult<impl Iterator<Item = EdgeRef<'a, NK, EK, S>>, NK, EK, S>
Get all incoming edges
pub fn get_outgoing<'a>( &'a self, node_id: NK, ) -> SchemaResult<impl Iterator<Item = EdgeRef<'a, NK, EK, S>>, NK, EK, S>
pub fn get_incoming_and_outgoing<'a>( &'a self, node_id: NK, ) -> SchemaResult<impl Iterator<Item = EdgeRef<'a, NK, EK, S>>, NK, EK, S>
pub fn get_outgoing_filter<'a, F>( &'a self, node_id: NK, filter: F, ) -> SchemaResult<impl Iterator<Item = EdgeRef<'a, NK, EK, S>>, NK, EK, S>
pub fn get_incoming_filter<'a, F>( &'a self, node_id: NK, filter: F, ) -> SchemaResult<impl Iterator<Item = EdgeRef<'a, NK, EK, S>>, NK, EK, S>
pub fn get_incoming_and_outgoing_filter<'a, F>( &'a self, node_id: NK, filter: F, ) -> SchemaResult<impl Iterator<Item = EdgeRef<'a, NK, EK, S>>, NK, EK, S>
pub fn nodes(&self) -> impl Iterator<Item = &S::N> + '_
pub fn edges(&self) -> impl Iterator<Item = &S::E> + '_
pub fn edges_full<'a>( &'a self, ) -> impl Iterator<Item = EdgeRef<'a, NK, EK, S>> + 'a
pub fn nodes_downcast<'a, T: 'a>(&'a self) -> impl Iterator<Item = T> + 'a
pub fn edges_downcast<'a, T: 'a>(&'a self) -> impl Iterator<Item = T> + 'a
pub fn node_ids(&self) -> impl Iterator<Item = NK> + '_
pub fn edge_ids(&self) -> impl Iterator<Item = EK> + '_
Sourcepub fn migrate<NS>(
self,
new_schema: NS,
handler: &S::Handler,
) -> GenericTypedResult<TypedGraph<NK, EK, NS>, NK, EK>
pub fn migrate<NS>( self, new_schema: NS, handler: &S::Handler, ) -> GenericTypedResult<TypedGraph<NK, EK, NS>, NK, EK>
Apply a Migration to the current graph
Sourcepub fn migrate_direct<NS>(
self,
) -> GenericTypedResult<TypedGraph<NK, EK, NS>, NK, EK>where
S: DirectMigration<NK, EK, NS>,
NS: SchemaExt<NK, EK>,
pub fn migrate_direct<NS>(
self,
) -> GenericTypedResult<TypedGraph<NK, EK, NS>, NK, EK>where
S: DirectMigration<NK, EK, NS>,
NS: SchemaExt<NK, EK>,
Migrate directly from one version to another
Sourcepub fn update_schema<NS, NF, EF>(
self,
schema: NS,
node_map: NF,
edge_map: EF,
) -> SchemaResult<TypedGraph<NK, EK, NS>, NK, EK, NS>
pub fn update_schema<NS, NF, EF>( self, schema: NS, node_map: NF, edge_map: EF, ) -> SchemaResult<TypedGraph<NK, EK, NS>, NK, EK, NS>
Convert the graph from one schema to another using two mapping functions The mapping functions are not allowed to change the id of any of the nodes only their data
Returning None from a mapping function will delete the node from the resulting graph
When mapping to a schema with lower bounds on the number of edges allowed from a node. Edges higher in the outgoing edge order will be removed
Trait Implementations§
Source§impl<NK, EK, S: Clone + SchemaExt<NK, EK>> Clone for TypedGraph<NK, EK, S>
impl<NK, EK, S: Clone + SchemaExt<NK, EK>> Clone for TypedGraph<NK, EK, S>
Source§fn clone(&self) -> TypedGraph<NK, EK, S>
fn clone(&self) -> TypedGraph<NK, EK, S>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<NK, EK, S> Default for TypedGraph<NK, EK, S>
impl<NK, EK, S> Default for TypedGraph<NK, EK, S>
Source§impl<'de, NK, EK, N, E, S> Deserialize<'de> for TypedGraph<NK, EK, S>where
NK: Key + Display + Deserialize<'de>,
EK: Key + Display + Deserialize<'de>,
N: NodeExt<NK> + Deserialize<'de>,
E: EdgeExt<EK> + Deserialize<'de>,
S: SchemaExt<NK, EK, N = N, E = E> + Deserialize<'de>,
Use the visitor to deserialize the TypedGraph
impl<'de, NK, EK, N, E, S> Deserialize<'de> for TypedGraph<NK, EK, S>where
NK: Key + Display + Deserialize<'de>,
EK: Key + Display + Deserialize<'de>,
N: NodeExt<NK> + Deserialize<'de>,
E: EdgeExt<EK> + Deserialize<'de>,
S: SchemaExt<NK, EK, N = N, E = E> + Deserialize<'de>,
Use the visitor to deserialize the TypedGraph
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<NK, EK, S> From<S> for TypedGraph<NK, EK, S>
impl<NK, EK, S> From<S> for TypedGraph<NK, EK, S>
Source§impl<NK, EK, N, E, S> Serialize for TypedGraph<NK, EK, S>
impl<NK, EK, N, E, S> Serialize for TypedGraph<NK, EK, S>
Auto Trait Implementations§
impl<NK, EK, S> Freeze for TypedGraph<NK, EK, S>where
S: Freeze,
impl<NK, EK, S> RefUnwindSafe for TypedGraph<NK, EK, S>where
S: RefUnwindSafe,
NK: RefUnwindSafe,
EK: RefUnwindSafe,
<S as SchemaExt<NK, EK>>::N: RefUnwindSafe,
<S as SchemaExt<NK, EK>>::E: RefUnwindSafe,
impl<NK, EK, S> Send for TypedGraph<NK, EK, S>
impl<NK, EK, S> Sync for TypedGraph<NK, EK, S>
impl<NK, EK, S> Unpin for TypedGraph<NK, EK, S>
impl<NK, EK, S> UnwindSafe for TypedGraph<NK, EK, S>where
S: UnwindSafe,
NK: UnwindSafe,
EK: UnwindSafe,
<S as SchemaExt<NK, EK>>::N: UnwindSafe,
<S as SchemaExt<NK, EK>>::E: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more