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§
Sourcefn untag(v: TagWrapper<Self, TM>) -> Self
fn untag(v: TagWrapper<Self, TM>) -> Self
Untags a value and returns it
Sourcefn untag_in_place(v: &mut TagWrapper<Self, TM>)
fn untag_in_place(v: &mut TagWrapper<Self, TM>)
Untags a value in place
Sourcefn get_tag(v: &TagWrapper<Self, TM>) -> Count
fn get_tag(v: &TagWrapper<Self, TM>) -> Count
Gets the tag associated with a value
Sourcefn tag(v: Self, o: Count) -> TagWrapper<Self, TM>
fn tag(v: Self, o: Count) -> TagWrapper<Self, TM>
Tag a value and return it
Sourcefn tag_in_place(v: &mut TagWrapper<Self, TM>, o: Count)
fn tag_in_place(v: &mut TagWrapper<Self, TM>, o: Count)
Tag a value in place
Sourcefn change_tag(v: &mut TagWrapper<Self, TM>, o: Count)
fn change_tag(v: &mut TagWrapper<Self, TM>, o: Count)
Change the tag on an already tagged value
Sourceunsafe fn uninitialized_from_tag(o: Count) -> TagWrapper<Self, TM>
unsafe fn uninitialized_from_tag(o: Count) -> TagWrapper<Self, TM>
Return a tagged (but otherwise uninitialized) value
Sourcefn fmt_untagged(v: &TagWrapper<Self, TM>, f: &mut Formatter<'_>) -> Resultwhere
Self: Debug,
fn fmt_untagged(v: &TagWrapper<Self, TM>, f: &mut Formatter<'_>) -> Resultwhere
Self: Debug,
A helper debug printing a value as though it weren’t tagged
Sourcefn eq(a: &TagWrapper<Self, TM>, b: &TagWrapper<Self, TM>) -> boolwhere
Self: PartialEq,
fn eq(a: &TagWrapper<Self, TM>, b: &TagWrapper<Self, TM>) -> boolwhere
Self: PartialEq,
A helper testing equality between tagged items
Sourcefn ne(a: &TagWrapper<Self, TM>, b: &TagWrapper<Self, TM>) -> boolwhere
Self: PartialEq,
fn ne(a: &TagWrapper<Self, TM>, b: &TagWrapper<Self, TM>) -> boolwhere
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.