Struct efficient_enum::EfficientOption [] [src]

pub struct EfficientOption<A, TaggingMethod = TagMSB>(_, _) where A: TaggableValue<TaggingMethod, Two>;

An option type similar to Option<A>, 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 &EfficientOption. The reason for this is that doing so would expose the private tag info.

Methods

impl<TaggingMethod, A> EfficientOption<A, TaggingMethod> where A: TaggableValue<TaggingMethod, Two>
[src]

Constructs a new EfficientOption

Constructs an empty EfficientOption

Constructs an EfficientOption from an A value

Destructures an EfficientOption

Returns true if the option is a Some value.

Returns true if the option is a None value.

Maps the value to a result

Trait Implementations

impl<TaggingMethod, A: Clone> Clone for EfficientOption<A, 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> Copy for EfficientOption<A, TaggingMethod> where A: TaggableValue<TaggingMethod, Two>
[src]

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

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

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

Formats the value using the given formatter.

impl<TaggingMethod, A: PartialEq> PartialEq for EfficientOption<A, 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> Eq for EfficientOption<A, TaggingMethod> where A: TaggableValue<TaggingMethod, Two>
[src]

impl<TaggingMethod, A: Hash> Hash for EfficientOption<A, 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> From<Option<A>> for EfficientOption<A, TaggingMethod> where A: TaggableValue<TaggingMethod, Two>
[src]

Performs the conversion.

impl<TaggingMethod, A> Into<Option<A>> for EfficientOption<A, TaggingMethod> where A: TaggableValue<TaggingMethod, Two>
[src]

Performs the conversion.