Trait TypeInfo

Source
pub trait TypeInfo: DynamicTypeInfo {
    const TYPE: Type;

    // Provided methods
    fn field<A>(&self, _id: FieldId<'_>) -> Option<&A>
       where A: Any { ... }
    fn field_mut<A>(&mut self, _id: FieldId<'_>) -> Option<&mut A>
       where A: Any { ... }
}
Expand description

A type that has compile-time static type information associated with it.

Required Associated Constants§

Source

const TYPE: Type

The constant statically known type information for this type.

Provided Methods§

Source

fn field<A>(&self, _id: FieldId<'_>) -> Option<&A>
where A: Any,

Get a 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.

Source

fn field_mut<A>(&mut self, _id: FieldId<'_>) -> Option<&mut A>
where A: Any,

Get a mutable 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.

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.

Implementations on Foreign Types§

Source§

impl TypeInfo for bool

Source§

impl TypeInfo for char

Source§

impl TypeInfo for f32

Source§

impl TypeInfo for f64

Source§

impl TypeInfo for i8

Source§

impl TypeInfo for i16

Source§

impl TypeInfo for i32

Source§

impl TypeInfo for i64

Source§

impl TypeInfo for isize

Source§

impl TypeInfo for u8

Source§

impl TypeInfo for u16

Source§

impl TypeInfo for u32

Source§

impl TypeInfo for u64

Source§

impl TypeInfo for usize

Implementors§