pub struct CycleDetector<Cx, T, B> { /* private fields */ }Expand description
Detector for cycles in directed graphs.
Implementations§
Source§impl<Cx: Copy, T: Copy + Eq + Hash, B> CycleDetector<Cx, T, B>
impl<Cx: Copy, T: Copy + Eq + Hash, B> CycleDetector<Cx, T, B>
Sourcepub fn detect(
cx: Cx,
vertex: T,
f: fn(Cx, &mut CycleDetector<Cx, T, B>, T) -> CycleDetectorResult<B, T>,
) -> CycleDetectorResult<B, T>
pub fn detect( cx: Cx, vertex: T, f: fn(Cx, &mut CycleDetector<Cx, T, B>, T) -> CycleDetectorResult<B, T>, ) -> CycleDetectorResult<B, T>
Creates a new cycle detector and runs it on the given vertex.
Returns Err if a cycle is detected, containing the first vertex in the cycle.
Sourcepub fn new(
cx: Cx,
f: fn(Cx, &mut CycleDetector<Cx, T, B>, T) -> CycleDetectorResult<B, T>,
) -> Self
pub fn new( cx: Cx, f: fn(Cx, &mut CycleDetector<Cx, T, B>, T) -> CycleDetectorResult<B, T>, ) -> Self
Creates a new cycle detector.
Sourcepub fn run(&mut self, vertex: T) -> CycleDetectorResult<B, T>
pub fn run(&mut self, vertex: T) -> CycleDetectorResult<B, T>
Runs the cycle detector on the given vertex.
Returns Err if a cycle is detected, containing the first vertex in the cycle.
Auto Trait Implementations§
impl<Cx, T, B> Freeze for CycleDetector<Cx, T, B>
impl<Cx, T, B> RefUnwindSafe for CycleDetector<Cx, T, B>where
Cx: RefUnwindSafe,
T: RefUnwindSafe,
impl<Cx, T, B> Send for CycleDetector<Cx, T, B>
impl<Cx, T, B> Sync for CycleDetector<Cx, T, B>
impl<Cx, T, B> Unpin for CycleDetector<Cx, T, B>
impl<Cx, T, B> UnwindSafe for CycleDetector<Cx, T, B>where
Cx: UnwindSafe,
T: 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
Mutably borrows from an owned value. Read more
Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
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>
Converts
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>
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.