[][src]Trait tagged_box::TaggableInner

pub trait TaggableInner: Sized {
    fn into_tagged_box(self) -> TaggedBox<Self>;
fn from_tagged_box(tagged: TaggedBox<Self>) -> Self;
unsafe fn ref_from_tagged_box<F>(tagged: &TaggedBox<Self>, callback: F)
    where
        F: FnOnce(&Self)
; }

Represents a value able to be stored in a TaggedBox.

Using this directly is not recommended, as tagged_box! should be used instead.
If you want to implement this yourself, see manually implementing a tagged enum.

Required methods

fn into_tagged_box(self) -> TaggedBox<Self>

Creates a TaggedBox from self, storing it on the heap and keeping it's discriminant in the pointer.
See TaggedPointer for more

fn from_tagged_box(tagged: TaggedBox<Self>) -> Self

Creates an instance of Self from a TaggedBox, taking ownership of the value

unsafe fn ref_from_tagged_box<F>(tagged: &TaggedBox<Self>, callback: F) where
    F: FnOnce(&Self), 

Run a closure on a reference to the value contained in tagged

Safety

The closure supplied to callback must not move the referenced value

Loading content...

Implementors

Loading content...