Enum static_reflect::types::TypeInfo[][src]

pub enum TypeInfo<'a> {
Show 15 variants Unit, Never, Bool, Integer(IntType), Float { size: FloatSize, }, Slice { element_type: &'a TypeInfo<'a>, }, Str, Optional(&'a TypeInfo<'a>), Pointer, Structure(&'a StructureDef<'a>), UntaggedUnion(&'a UntaggedUnionDef<'a>), TaggedUnion(&'a TaggedUnionDef<'a>), CStyleEnum(&'a CStyleEnumDef<'a>), Extern { name: &'static str, }, Magic { id: &'static &'static str, extra: Option<&'a TypeInfo<'a>>, },
}
Expand description

A type whose representation is known via reflection

These are usually defined statically via [StaticReflect

However, they can be allocated at runtime, and potentially live for a more limited lifetime.

Variants

Unit

The zero-length unit type ()

Used for functions that return nothing

Never

An impossible type,

The mere existence of this type at runtime is undefined behavior. Functions that have this as their return type never actually return.

Bool

A boolean

Like a Rust bool, values must be either zero or one. Anything else is undefined behavior.

Integer

An integer

Tuple Fields of Integer

0: IntType
Float

A floating point number

Fields of Float

size: FloatSize

The size/precision of the float

Slice

A slice of memory, represented as pointer + length

The element type is needed, since array indexing implicitly multiples by the size of the memory.

Representation should match the AsmSlice type

Fields of Slice

element_type: &'a TypeInfo<'a>

The type of the inner element

Str

A pointer to a UTF8 encoded string and length, just like Rust’s ‘str’ type

Internally represented by the AsmStr structure

Optional

A very simple optional, represented as an AsmOption

This never uses the null pointer optimization

Tuple Fields of Optional

0: &'a TypeInfo<'a>
Pointer

An untyped pointer

This may be null.

Untyped pointers simplify the type system significantly. They also avoid cycles when defining structures in case a structure contains a pointer to itself.

Structure

A structure

Tuple Fields of Structure

0: &'a StructureDef<'a>
UntaggedUnion

An untagged union

Tuple Fields of UntaggedUnion

0: &'a UntaggedUnionDef<'a>
TaggedUnion

A tagged union with a well-defined Rust-compatible layout. See RFC #2195 for complete details on how #[repr(C)] enums are defined.

There are two different representations for tagged unions. See TaggedUnionStyle for details.

Tuple Fields of TaggedUnion

0: &'a TaggedUnionDef<'a>
CStyleEnum

A C-style enum, without any data.

See TypeInfo::TaggedUnion for enums with data.

Tuple Fields of CStyleEnum

0: &'a CStyleEnumDef<'a>
Extern

A named, transparent, extern type

Fields of Extern

name: &'static str

The name of the type

Since this is all we have, it’s what used to disambiguate between them.

Magic

A ‘magic’ type, with a user-defined meaning

This allows extensions to the type system

Fields of Magic

id: &'static &'static str

The id of the magic type, giving more information about how its implemented and what it actually means.

extra: Option<&'a TypeInfo<'a>>

Extra information (if any)

Implementations

A 32-bit, single-precision float

A 64-bit, double-precision float

The size of the type, in bytes

The alignment of the type, matching std::mem::align_of

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

This type with all garbage collected lifetimes changed to 'static (or erased) Read more

This type with all garbage collected lifetimes changed to 'new_gc Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Whether this type needs to be traced by the garbage collector. Read more

If this type needs a destructor run. Read more

Visit each field in this type Read more

Visit this object, assuming its already inside a GC pointer. Read more

Visit an immutable reference to this type Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.