pub unsafe trait Tagged<'a>: Sealed + 'a {
// Required method
fn tag_id(&self) -> TypeId;
}Expand description
Sealed trait representing a type-erased tagged object.
Required Methods§
Implementations§
Source§impl<'a> dyn Tagged<'a>
impl<'a> dyn Tagged<'a>
Sourcepub fn tag_ref<I>(value: &I::Type) -> &dyn Tagged<'a>where
I: Tag<'a>,
pub fn tag_ref<I>(value: &I::Type) -> &dyn Tagged<'a>where
I: Tag<'a>,
Tag a reference to a concrete type with a given Tag.
This is like an unsizing coercion, but must be performed explicitly to specify the specific tag.
Sourcepub fn tag_mut<I>(value: &mut I::Type) -> &mut dyn Tagged<'a>where
I: Tag<'a>,
pub fn tag_mut<I>(value: &mut I::Type) -> &mut dyn Tagged<'a>where
I: Tag<'a>,
Tag a reference to a concrete type with a given Tag.
This is like an unsizing coercion, but must be performed explicitly to specify the specific tag.
Sourcepub fn tag_box<I>(value: Box<I::Type>) -> Box<dyn Tagged<'a>>where
I: Tag<'a>,
pub fn tag_box<I>(value: Box<I::Type>) -> Box<dyn Tagged<'a>>where
I: Tag<'a>,
Tag a Box of a concrete type with a given Tag.
This is like an unsizing coercion, but must be performed explicitly to specify the specific tag.
Sourcepub fn is<I>(&self) -> boolwhere
I: Tag<'a>,
pub fn is<I>(&self) -> boolwhere
I: Tag<'a>,
Returns true if the dynamic type is tagged with I.
Sourcepub fn downcast_ref<I>(&self) -> Option<&I::Type>where
I: Tag<'a>,
pub fn downcast_ref<I>(&self) -> Option<&I::Type>where
I: Tag<'a>,
Returns some reference to the dynamic value if it is tagged with I,
or None if it isn’t.
Sourcepub fn downcast_mut<I>(&mut self) -> Option<&mut I::Type>where
I: Tag<'a>,
pub fn downcast_mut<I>(&mut self) -> Option<&mut I::Type>where
I: Tag<'a>,
Returns some reference to the dynamic value if it is tagged with I,
or None if it isn’t.