pub enum CycleDetector<T> {
Unprocessed,
Processing,
Cyclic,
Processed(T),
}Expand description
An enum to manage potentially-cyclic computations.
Variants§
Unprocessed
We haven’t analyzed this yet.
Processing
Sentinel value that we set when starting the computation on an item. If we ever encounter this, we know we encountered a loop that we can’t handle.
Cyclic
Sentinel value we put when encountering a cycle, so we can know that happened.
Processed(T)
The final result of the computation.
Implementations§
Source§impl<T> CycleDetector<T>
impl<T> CycleDetector<T>
Source§impl<T> CycleDetector<T>
impl<T> CycleDetector<T>
pub fn as_unprocessed_mut(&mut self) -> Option<()>
pub fn as_processing_mut(&mut self) -> Option<()>
pub fn as_cyclic_mut(&mut self) -> Option<()>
pub fn as_processed_mut(&mut self) -> Option<&mut T>
Source§impl<T> CycleDetector<T>
impl<T> CycleDetector<T>
Sourcepub fn start_processing(&mut self) -> bool
pub fn start_processing(&mut self) -> bool
If this item hadn’t been processed, return true and record it as Processing, otherwise
return false. If this item is already processing, record a cycle.
pub fn done_processing(&mut self, x: T)
Trait Implementations§
Source§impl<T: Debug> Debug for CycleDetector<T>
impl<T: Debug> Debug for CycleDetector<T>
Auto Trait Implementations§
impl<T> Freeze for CycleDetector<T>where
T: Freeze,
impl<T> RefUnwindSafe for CycleDetector<T>where
T: RefUnwindSafe,
impl<T> Send for CycleDetector<T>where
T: Send,
impl<T> Sync for CycleDetector<T>where
T: Sync,
impl<T> Unpin for CycleDetector<T>where
T: Unpin,
impl<T> UnwindSafe for CycleDetector<T>where
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
§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
Given the context attached to a nom error, and given the original
input to the nom parser, extract more the useful context information. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more§impl<I> RecreateContext<I> for I
impl<I> RecreateContext<I> for I
§fn recreate_context(_original_input: I, tail: I) -> I
fn recreate_context(_original_input: I, tail: I) -> I
Given the original input, as well as the context reported by nom,
recreate a context in the original string where the error occurred. Read more