Skip to main content

GraphMut

Trait GraphMut 

Source
pub trait GraphMut<V, E>: GraphRef<V, E> {
    // Required methods
    fn vertex_mut(&mut self, id: &Self::VertexId) -> Option<&mut V>;
    fn edge_mut(&mut self, id: &Self::EdgeId) -> Option<&mut E>;

    // Provided methods
    fn try_replace_vertex(
        &mut self,
        id: &Self::VertexId,
        vertex: V,
    ) -> Result<V, ReplaceVertexError<V>> { ... }
    fn replace_vertex(&mut self, id: &Self::VertexId, vertex: V) -> V { ... }
    fn try_replace_edge(
        &mut self,
        id: &Self::EdgeId,
        edge: E,
    ) -> Result<E, ReplaceEdgeError<E>> { ... }
    fn replace_edge(&mut self, id: &Self::EdgeId, edge: E) -> E { ... }
}
Expand description

Trait for mutable access to graph attributes.

§Implementation notes

Required Methods§

Source

fn vertex_mut(&mut self, id: &Self::VertexId) -> Option<&mut V>

Returns a mutable reference to the vertex attribute, if it exists.

Source

fn edge_mut(&mut self, id: &Self::EdgeId) -> Option<&mut E>

Returns a mutable reference to the edge attribute, if it exists.

Provided Methods§

Source

fn try_replace_vertex( &mut self, id: &Self::VertexId, vertex: V, ) -> Result<V, ReplaceVertexError<V>>

Replaces the attribute of a vertex with a new value, returning the old one.

If the vertex does not exist, an error is returned.

Source

fn replace_vertex(&mut self, id: &Self::VertexId, vertex: V) -> V

Replaces the attribute of a vertex with a new value, returning the old one.

§Panics

Panics if the vertex does not exist.

Source

fn try_replace_edge( &mut self, id: &Self::EdgeId, edge: E, ) -> Result<E, ReplaceEdgeError<E>>

Replaces the attribute of an edge with a new value, returning the old one.

If the edge does not exist, an error is returned.

Source

fn replace_edge(&mut self, id: &Self::EdgeId, edge: E) -> E

Replaces the attribute of an edge with a new value, returning the old one.

§Panics

Panics if the edge does not exist.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<V, E, G> GraphMut<V, E> for &mut G
where G: GraphMut<V, E>,

Source§

fn vertex_mut(&mut self, id: &Self::VertexId) -> Option<&mut V>

Source§

fn edge_mut(&mut self, id: &Self::EdgeId) -> Option<&mut E>

Source§

fn try_replace_vertex( &mut self, id: &Self::VertexId, vertex: V, ) -> Result<V, ReplaceVertexError<V>>

Source§

fn replace_vertex(&mut self, id: &Self::VertexId, vertex: V) -> V

Source§

fn try_replace_edge( &mut self, id: &Self::EdgeId, edge: E, ) -> Result<E, ReplaceEdgeError<E>>

Source§

fn replace_edge(&mut self, id: &Self::EdgeId, edge: E) -> E

Implementors§

Source§

impl<G, V, E> GraphMut<V, E> for CastAsDirected<G>
where G: GraphMut<V, E>,

Source§

impl<G, V, E> GraphMut<V, E> for CastAsUndirected<G>
where G: GraphMut<V, E>,

Source§

impl<G, V, E> GraphMut<V, E> for Transpose<G>
where G: GraphMut<V, E>,

Source§

impl<V, E, G> GraphMut<V, E> for Stable<G>
where G: GraphMut<V, E>,

Source§

impl<V, E, Ty: EdgeType, G> GraphMut<V, E> for Graph<V, E, Ty, G>
where G: GraphMut<V, E>,

Source§

impl<V, E, Ty: EdgeType, G> GraphMut<V, E> for Path<V, E, Ty, G>
where G: GraphMut<V, E> + GraphBase,

Source§

impl<V, E, Ty: EdgeType, Id: IdPair> GraphMut<V, E> for AdjList<V, E, Ty, Id>

Source§

impl<V, E, Ty: EdgeType, Id: IdPair> GraphMut<V, E> for AdjMatrix<V, E, Ty, Id>

Source§

impl<V, E, Ty: EdgeType, Id: IdPair> GraphMut<V, E> for EdgeList<V, E, Ty, Id>