Trait TaggableValue

Source
pub unsafe trait TaggableValue<TM, Count: TagOptions> {
    // Required methods
    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;
}
Expand description

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§

Source

fn untag(v: TagWrapper<Self, TM>) -> Self

Untags a value and returns it

Source

fn untag_in_place(v: &mut TagWrapper<Self, TM>)

Untags a value in place

Source

fn get_tag(v: &TagWrapper<Self, TM>) -> Count

Gets the tag associated with a value

Source

fn tag(v: Self, o: Count) -> TagWrapper<Self, TM>

Tag a value and return it

Source

fn tag_in_place(v: &mut TagWrapper<Self, TM>, o: Count)

Tag a value in place

Source

fn change_tag(v: &mut TagWrapper<Self, TM>, o: Count)

Change the tag on an already tagged value

Source

unsafe fn uninitialized_from_tag(o: Count) -> TagWrapper<Self, TM>

Return a tagged (but otherwise uninitialized) value

Source

fn fmt_untagged(v: &TagWrapper<Self, TM>, f: &mut Formatter<'_>) -> Result
where Self: Debug,

A helper debug printing a value as though it weren’t tagged

Source

fn eq(a: &TagWrapper<Self, TM>, b: &TagWrapper<Self, TM>) -> bool
where Self: PartialEq,

A helper testing equality between tagged items

Source

fn ne(a: &TagWrapper<Self, TM>, b: &TagWrapper<Self, TM>) -> bool
where Self: PartialEq,

A helper testing inequality between tagged items

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TaggableValue<TagMSB, Two> for u8

Source§

impl TaggableValue<TagMSB, Two> for u16

Source§

impl TaggableValue<TagMSB, Two> for u32

Source§

impl TaggableValue<TagMSB, Two> for u64

Source§

impl TaggableValue<TagMSB, Two> for usize

Implementors§

Source§

impl<T, TM> TaggableValue<TM, One> for T
where T: UntaggedZero<TM, Two>,