Struct efficient_enum::option::EfficientOptionTuple [] [src]

pub struct EfficientOptionTuple<A, B, TM = TagMSB>(_, _)
where
    A: TaggableValue<TM, Two>
;

An option type similar to (A, Option<B>), but where no extra data is used. Instead, some of the space in A is used to "tag the union".

The one true downside is that it is impossible to get &A from &EfficientOptionTuple. The reason for this is that doing so would expose the private tag info.

Methods

impl<TM, A, B> EfficientOptionTuple<A, B, TM> where
    A: TaggableValue<TM, Two>, 
[src]

Constructs a new EfficientOptionTuple

Constructs an EfficientOptionTuple with no B value

Constructs an EfficientOptionTuple with a B value

Destructures an EfficientOptionTuple

Destructures an EfficientOptionTuple into the A value

Destructures an EfficientOptionTuple into the B value if one exists

Destructures an EfficientOptionTuple by assuming the B values exists

Destructures an EfficientOptionTupleinto the B value by assuming one exists

Takes the B value out of the option, leaving a None in its place.

Returns true if the option is a Some value.

Returns true if the option is a None value.

Returns an EfficientOptionTupleInnerSome if the option is a Some value, returns an EfficientOptionTupleInnerNone otherwise.

Returns an EfficientOptionTupleInnerSome.

Returns an EfficientOptionTupleInnerSome.

Clones the A value

Clones the B value if one exists

Gets a reference to the B value if one exists

Gets a reference to the B value by assuming one exists

Gets mutable a reference to the B value if one exists

Gets mutable a reference to the B value if one exists

Replaces the A value

Replaces the B value

Maps the A and B values to a result

Trait Implementations

impl<TM, A: Clone, B: Clone> Clone for EfficientOptionTuple<A, B, TM> where
    A: TaggableValue<TM, Two>, 
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<TM, A: Copy, B: Copy> Copy for EfficientOptionTuple<A, B, TM> where
    A: TaggableValue<TM, Two>, 
[src]

impl<TM, A: Default, B> Default for EfficientOptionTuple<A, B, TM> where
    A: TaggableValue<TM, Two>, 
[src]

Returns the "default value" for a type. Read more

impl<TM, A: Debug, B: Debug> Debug for EfficientOptionTuple<A, B, TM> where
    A: TaggableValue<TM, Two>, 
[src]

Formats the value using the given formatter.

impl<TM, A: PartialEq, B: PartialEq> PartialEq for EfficientOptionTuple<A, B, TM> where
    A: TaggableValue<TM, Two>, 
[src]

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

This method tests for !=.

impl<TM, A: Eq, B: Eq> Eq for EfficientOptionTuple<A, B, TM> where
    A: TaggableValue<TM, Two>, 
[src]

impl<TM, A: Hash, B: Hash> Hash for EfficientOptionTuple<A, B, TM> where
    A: TaggableValue<TM, Two>, 
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<TM, A, B> From<(A, Option<B>)> for EfficientOptionTuple<A, B, TM> where
    A: TaggableValue<TM, Two>, 
[src]

Performs the conversion.

impl<TM, A, B> Into<(A, Option<B>)> for EfficientOptionTuple<A, B, TM> where
    A: TaggableValue<TM, Two>, 
[src]

Performs the conversion.