Trait core::any::Erased

source ·
unsafe trait Erased<'a>: 'a {
    // Required method
    fn tag_id(&self) -> TypeId;
}
Expand description

Represents a type-erased but identifiable object.

This trait is exclusively implemented by the TaggedOption type.

Required Methods§

source

fn tag_id(&self) -> TypeId

The TypeId of the erased type.

Implementations§

source§

impl<'a> dyn Erased<'a> + 'a

source

fn downcast<I>(&self) -> Option<&TaggedOption<'a, I>>where I: Type<'a>,

🔬This is a nightly-only experimental API. (provide_any #96024)

Returns some reference to the dynamic value if it is tagged with I, or None otherwise.

source

fn downcast_mut<I>(&mut self) -> Option<&mut TaggedOption<'a, I>>where I: Type<'a>,

🔬This is a nightly-only experimental API. (provide_any #96024)

Returns some mutable reference to the dynamic value if it is tagged with I, or None otherwise.

Implementors§

source§

impl<'a, I: Type<'a>> Erased<'a> for TaggedOption<'a, I>