Enum pushgen::TryReduction
source · pub enum TryReduction<T> {
Complete(T),
Partial(T),
}
Expand description
The result value of a try_*
reduction.
A try_*
reduction can either be partial, producing an intermediate value, or complete. Partial
reductions can for instance be created when trying to reduce a spuriously stopping generator.
Variants§
Complete(T)
The reduction has completed, with the associated result.
Partial(T)
The reduction is only partially completed. The associated value should be used when trying to complete the reduction in the future.
Implementations§
source§impl<T> TryReduction<T>
impl<T> TryReduction<T>
sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if the reduction is complete.
Examples
Basic usage:
use pushgen::TryReduction;
let x = TryReduction::Complete(());
assert!(x.is_complete());
assert!(!x.is_partial());
sourcepub fn is_partial(&self) -> bool
pub fn is_partial(&self) -> bool
Check if the reduction is partial.
Examples
Basic usage:
use pushgen::TryReduction;
let x = TryReduction::Partial(());
assert!(x.is_partial());
assert!(!x.is_complete());
Trait Implementations§
source§impl<T: Clone> Clone for TryReduction<T>
impl<T: Clone> Clone for TryReduction<T>
source§fn clone(&self) -> TryReduction<T>
fn clone(&self) -> TryReduction<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for TryReduction<T>
impl<T: Debug> Debug for TryReduction<T>
source§impl<T: Ord> Ord for TryReduction<T>
impl<T: Ord> Ord for TryReduction<T>
source§fn cmp(&self, other: &TryReduction<T>) -> Ordering
fn cmp(&self, other: &TryReduction<T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T: PartialEq> PartialEq<TryReduction<T>> for TryReduction<T>
impl<T: PartialEq> PartialEq<TryReduction<T>> for TryReduction<T>
source§fn eq(&self, other: &TryReduction<T>) -> bool
fn eq(&self, other: &TryReduction<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<T: PartialOrd> PartialOrd<TryReduction<T>> for TryReduction<T>
impl<T: PartialOrd> PartialOrd<TryReduction<T>> for TryReduction<T>
source§fn partial_cmp(&self, other: &TryReduction<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &TryReduction<T>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more