Enum pushgen::TryReduction[][src]

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

Tuple Fields of Complete

0: T
Partial

Tuple Fields of Partial

0: T

Implementations

Check if the reduction is complete.

Examples

Basic usage:

use pushgen::TryReduction;
let x = TryReduction::Complete(());
assert!(x.is_complete());
assert!(!x.is_partial());

Check if the reduction is partial.

Examples

Basic usage:

use pushgen::TryReduction;
let x = TryReduction::Partial(());
assert!(x.is_partial());
assert!(!x.is_complete());

Get the underlying value, no matter if it’s complete or partial.

Examples

Basic usage:

use pushgen::TryReduction;
let complete = TryReduction::Complete(1);
assert_eq!(complete.unwrap(), 1);
let partial = TryReduction::Partial(2);
assert_eq!(partial.unwrap(), 2);

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.