Struct efficient_enum::EfficientOptionTuple [] [src]

pub struct EfficientOptionTuple<A, B, TaggingMethod = TagMSB>(_, _, _) where A: TaggableValue<TaggingMethod, 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<TaggingMethod, A, B> EfficientOptionTuple<A, B, TaggingMethod> where A: TaggableValue<TaggingMethod, Two>
[src]

Constructs a new EfficientOptionTuple

Constructs an EfficientOptionTuple with no B value

Constructs an EfficientOptionTuple with a B value

Destructures an EfficientOptionTuple

Returns true if the option is a Some value.

Returns true if the option is a None value.

Clones the A value

Clones the B value if one exists

Gets 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<TaggingMethod, A: Clone, B: Clone> Clone for EfficientOptionTuple<A, B, TaggingMethod> where A: TaggableValue<TaggingMethod, Two>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

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

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

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

Formats the value using the given formatter.

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

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

This method tests for !=.

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

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

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

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

Performs the conversion.

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

Performs the conversion.