Trait type_info::DynamicTypeInfo
[−]
[src]
pub trait DynamicTypeInfo { fn type_ref(&self) -> &'static Type; fn variant(&self) -> Option<&str> { ... } fn field_any(&self, _id: FieldId) -> Option<&Any> { ... } fn field_any_mut(&mut self, _id: FieldId) -> Option<&mut Any> { ... } }
A type that has compile-time dynamic type information associated with it.
This trait is built to be compatible with being a trait object.
Required Methods
Provided Methods
fn variant(&self) -> Option<&str>
Get the id of the currently active variant of this type, or None
if the type is not
an enum
.
fn field_any(&self, _id: FieldId) -> Option<&Any>
Get a dynamic reference to the value of a field on this type with the given field id.
This method will return the current value of the given field if possible, or None
if the
given field does not exist or does not have a type matching the supplied type.
fn field_any_mut(&mut self, _id: FieldId) -> Option<&mut Any>
Get a mutable dynamic reference to the value of a field on this type with the given field id.
This method will return the current value of the given field if possible, or None
if the
given field does not exist or does not have a type matching the supplied type.