Skip to main content

Module reflection

Module reflection 

Source
Expand description

Object reflection: look up the methods, fields and type attributes of registered types; register Rust object types with ObjectDef, type attributes with TypeAttrDef and enum values with EnumDef; call the typed hooks that attributes hold with NativeFunction.

Structs§

AccessPath
A path from a root value to a nested one, such as root.field[0], as a chain of parents; its methods are reached with reflection::get_method.
AccessPathObj
The object behind an AccessPath, laid out as the C++ AccessPathObj.
AccessStep
One step of an AccessPath: an attribute, array index or map key.
AccessStepObj
The object behind an AccessStep, laid out as the C++ AccessStepObj.
EnumAttrMap
One attribute of the values of the enum type E, as V, returned by EnumRef::attr_map.
EnumDef
Registers a value of the enum type E, then its attributes.
FieldFlags
The reflection flags of one field, combined with |.
FieldGetter
Resolves a reflected field once, then uses its registered C ABI getter.
NativeFunction
A typed hook that a type attribute, an enum attribute or another registry slot holds: a native function, called directly through the C ABI, or a packed Function registered in its place.
ObjectDef
Registers the reflection of the object type N: the metadata, each #[reflect] field, the methods and the type attributes.
TypeAttrColumn
A registry-owned type-attribute column indexed by runtime type.
TypeAttrDef
Registers type attributes of the object type T, each as soon as set_attr names it, for every language to read with TypeAttrColumn.

Enums§

AccessKind
What an AccessStep accesses: an attribute, an array item or a map item, or one of those that is missing.
SEqHashKind
How the structural engines treat instances of a type.

Traits§

NativeArgs
The argument tuples a NativeFunction takes: up to eight borrowed objects, managed references or Any values.
ShallowCopy
A copy of an object’s own fields under a fresh object header, which __ffi_shallow_copy__ returns; fields that are references share their objects, as Clone of an Arc does.
UnsafeInit
An object type whose object can start with every field undefined, for reflection to set the fields.

Functions§

field_default
The default value T registers for its field name, or None if T registers no such field, the field has no default, or its default comes from a factory.
get_method
Look up a reflected method of a type by type key and method name.
get_method_by_index
Look up a reflected method of a type by type index and method name, as get_method does by type key.
type_key
The type key registered for type_index, such as "ffi.Array", or None if no type has that index.
unsafe_init⚠
An object of T with every field undefined, zero-filled, for reflection to set the fields through their setters.