Trait efficient_enum::tag::TaggableValue
[−]
[src]
pub unsafe trait TaggableValue<TM, Count: TagOptions> { fn untag(v: TagWrapper<Self, TM>) -> Self; fn untag_in_place(v: &mut TagWrapper<Self, TM>); fn get_tag(v: &TagWrapper<Self, TM>) -> Count; fn tag(v: Self, o: Count) -> TagWrapper<Self, TM>; fn tag_in_place(v: &mut TagWrapper<Self, TM>, o: Count); fn change_tag(v: &mut TagWrapper<Self, TM>, o: Count); unsafe fn uninitialized_from_tag(o: Count) -> TagWrapper<Self, TM>; fn fmt_untagged(v: &TagWrapper<Self, TM>, f: &mut Formatter) -> Result
where
Self: Debug; fn eq(a: &TagWrapper<Self, TM>, b: &TagWrapper<Self, TM>) -> bool
where
Self: PartialEq; fn ne(a: &TagWrapper<Self, TM>, b: &TagWrapper<Self, TM>) -> bool
where
Self: PartialEq; }
A trait representing a value which can have some space dedicated to use for tagging a union If you implement this trait incorrectly, you will break memory safety.
Required Methods
fn untag(v: TagWrapper<Self, TM>) -> Self
Untags a value and returns it
fn untag_in_place(v: &mut TagWrapper<Self, TM>)
Untags a value in place
fn get_tag(v: &TagWrapper<Self, TM>) -> Count
Gets the tag associated with a value
fn tag(v: Self, o: Count) -> TagWrapper<Self, TM>
Tag a value and return it
fn tag_in_place(v: &mut TagWrapper<Self, TM>, o: Count)
Tag a value in place
fn change_tag(v: &mut TagWrapper<Self, TM>, o: Count)
Change the tag on an already tagged value
unsafe fn uninitialized_from_tag(o: Count) -> TagWrapper<Self, TM>
Return a tagged (but otherwise uninitialized) value
fn fmt_untagged(v: &TagWrapper<Self, TM>, f: &mut Formatter) -> Result where
Self: Debug,
Self: Debug,
A helper debug printing a value as though it weren't tagged
fn eq(a: &TagWrapper<Self, TM>, b: &TagWrapper<Self, TM>) -> bool where
Self: PartialEq,
Self: PartialEq,
A helper testing equality between tagged items
fn ne(a: &TagWrapper<Self, TM>, b: &TagWrapper<Self, TM>) -> bool where
Self: PartialEq,
Self: PartialEq,
A helper testing inequality between tagged items