A type that represents one of two alternatives

Enum Either

The either type

Variants

Implementation of core::cmp::Eq for Either<T, U>

Method eq

fn eq(__other: &Either<T, U>) -> bool

Method ne

fn ne(__other: &Either<T, U>) -> bool

Implementation for Either<T, U>

Method unwrap_left

fn unwrap_left() -> T

Method unwrap_right

fn unwrap_right() -> U

Function either

fn either<T, U,
          V>(f_left: &fn(&T) -> V, f_right: &fn(&U) -> V,
             value: &Either<T, U>) -> V

Applies a function based on the given either value

If value is left(T) then f_left is applied to its contents, if value is right(U) then f_right is applied to its contents, and the result is returned.

Function flip

fn flip<T: Copy, U: Copy>(eith: &Either<T, U>) -> Either<U, T>

Flips between left and right of a given either

Function is_left

fn is_left<T, U>(eith: &Either<T, U>) -> bool

Checks whether the given value is a left

Function is_right

fn is_right<T, U>(eith: &Either<T, U>) -> bool

Checks whether the given value is a right

Function lefts

fn lefts<T: Copy, U>(eithers: &[Either<T, U>]) -> ~[T]

Extracts from a vector of either all the left values

Function partition

fn partition<T: Copy, U: Copy>(eithers: &[Either<T, U>]) -> (~[T], ~[U])

Extracts from a vector of either all the left values and right values

Returns a structure containing a vector of left values and a vector of right values.

Function rights

fn rights<T, U: Copy>(eithers: &[Either<T, U>]) -> ~[U]

Extracts from a vector of either all the right values

Function to_result

fn to_result<T: Copy, U: Copy>(eith: &Either<T, U>) -> Result<U, T>

Converts either::t to a result::t

Converts an either type to a result type, making the "right" choice an ok result, and the "left" choice a fail

Function unwrap_left

fn unwrap_left<T, U>(eith: Either<T, U>) -> T

Retrieves the value in the left branch. Fails if the either is Right.

Function unwrap_right

fn unwrap_right<T, U>(eith: Either<T, U>) -> U

Retrieves the value in the right branch. Fails if the either is Left.