Struct graphene::core::Unconstrainer
[−]
[src]
pub struct Unconstrainer<'a, V, W, Vi, Ei, G> where
V: Vertex,
W: Weight,
Vi: VertexIter<V>,
Ei: EdgeIter<V, W>,
<Vi as IntoIterator>::IntoIter: ExactSizeIterator,
<Ei as IntoIterator>::IntoIter: ExactSizeIterator,
G: 'a + ConstrainedGraph<Vertex = V, Weight = W, VertexIter = Vi, EdgeIter = Ei>, { /* fields omitted */ }
Handles execution of a set of mutating operations on a given graph 'atomically', in the sense that constraints are only verified after all the operation have been executed.
The operations are executed lazily, i.e. only when constrain()
is called.
Methods
impl<'a, V, W, Vi, Ei, G> Unconstrainer<'a, V, W, Vi, Ei, G> where
V: Vertex,
W: Weight,
Vi: VertexIter<V>,
Ei: EdgeIter<V, W>,
<Vi as IntoIterator>::IntoIter: ExactSizeIterator,
<Ei as IntoIterator>::IntoIter: ExactSizeIterator,
G: ConstrainedGraph<Vertex = V, Weight = W, VertexIter = Vi, EdgeIter = Ei>,
[src]
V: Vertex,
W: Weight,
Vi: VertexIter<V>,
Ei: EdgeIter<V, W>,
<Vi as IntoIterator>::IntoIter: ExactSizeIterator,
<Ei as IntoIterator>::IntoIter: ExactSizeIterator,
G: ConstrainedGraph<Vertex = V, Weight = W, VertexIter = Vi, EdgeIter = Ei>,
pub fn new(g: &'a mut G) -> Self
[src]
pub fn add_vertex(self, v: V) -> Self
[src]
Enqueues an addition of the given vertex to the list of operations.
pub fn remove_vertex(self, v: V) -> Self
[src]
Enqueues a removal of the given vertex to the list of operations.
pub fn add_edge(self, e: BaseEdge<V, W>) -> Self
[src]
Enqueues an addition of the given edge to the list of operations.
pub fn remove_edge(self, e: BaseEdge<V, W>) -> Self
[src]
Enqueues a removal of the given edge to the list of operations.
pub fn constrain(self) -> Result<(), ()>
[src]
Executes all operations in the list, ensuring that each one isn't rejected and then checks the invariant of the graph.
If any operation is rejected, or the invariant of the graph does not hold after
all operations are executed, any change made is rolled back, and Err
is returned.
Guarantees that if Ok
is returned, then the graph upholds its constraint invariant.
Trait Implementations
Auto Trait Implementations
impl<'a, V, W, Vi, Ei, G> Send for Unconstrainer<'a, V, W, Vi, Ei, G> where
G: Send,
V: Send,
W: Send,
G: Send,
V: Send,
W: Send,
impl<'a, V, W, Vi, Ei, G> Sync for Unconstrainer<'a, V, W, Vi, Ei, G> where
G: Sync,
V: Sync,
W: Sync,
G: Sync,
V: Sync,
W: Sync,