Trait static_reflect::StaticReflect[][src]

pub unsafe trait StaticReflect {
    const TYPE_INFO: TypeInfo<'static>;
}

The trait for types whose information can be accessed via static reflection.

In order to proper access any fields, the representation must be C-compatible. Otherwise, transmutes and pointer-arithmetic are pointless because they are already undefined behavior.

Safety

Incorrect implementation of this trait is considered undefined behavior. All the static type information must be correct at runtime.

For example, if this type gives field information via FieldReflect, then the field information must match the representation at runtime.

The advantage of this is that other crates can rely on the representation being stable (for example, JIT compilers can use it).

The type must be #[repr(C)] or have some other form of FFI safety.

Associated Constants

const TYPE_INFO: TypeInfo<'static>[src]

The static information about the type’s representation

Loading content...

Implementations on Foreign Types

impl StaticReflect for u8[src]

impl StaticReflect for u16[src]

impl StaticReflect for u32[src]

impl StaticReflect for u64[src]

impl StaticReflect for i8[src]

impl StaticReflect for i16[src]

impl StaticReflect for i32[src]

impl StaticReflect for i64[src]

impl StaticReflect for usize[src]

impl StaticReflect for isize[src]

impl StaticReflect for str[src]

impl StaticReflect for ()[src]

impl StaticReflect for bool[src]

impl StaticReflect for f32[src]

impl StaticReflect for f64[src]

impl StaticReflect for ![src]

impl<T: StaticReflect> StaticReflect for ManuallyDrop<T>[src]

Support StaticReflect for ManuallyDrop by just representing the inner type

impl<T> StaticReflect for *mut T[src]

A pointer

NOTE: The pointed-to value can be anything, even if it doesn’t implement StaticReflect.

This is fine since the static reflection system doesn’t maintain information about pointers (to avoid cycles).

impl<T> StaticReflect for *const T[src]

An immutable pointer

The static reflection system makes no distinction between mutable and immutable pointers.

impl<T> StaticReflect for NonNull<T>[src]

impl<T: SimpleNonZeroPointer> StaticReflect for Option<T>[src]

Loading content...

Implementors

Loading content...