logos.mem.any

Module mem · package logos-mem

Types

structAnnotationInfo

struct AnnotationInfo

Descriptor of a single annotation instance: its type name plus key/value arguments.

Fields

info: WritStatic
map_bits: i64

Methods

fn get_int(self: &AnnotationInfo, key: &[u8]) -> i64

Reads an integer argument of the annotation by key; returns 0 if absent or non-integer.

fn get_str(self: &AnnotationInfo, key: &[u8]) -> StringView

Reads a string argument of the annotation by key; returns an empty view if absent.

fn type_name(self: &AnnotationInfo) -> StringView

Returns the fully-qualified annotation type name (e.g. "reflect_basic::Deprecated").

structAnnotationsView

struct AnnotationsView

Array view over a TypeInfo’s annotation instances, obtained via TypeInfo::annotations.

Fields

arr_bits: i64
info: WritStatic

Methods

fn get(self: &AnnotationsView, idx: u64) -> AnnotationInfo

Returns the annotation descriptor at index idx.

fn len(self: &AnnotationsView) -> u64

Returns the number of annotation instances.

structFieldInfo

struct FieldInfo

Descriptor of a single struct field: its name and the name of its type.

Fields

info: WritStatic
map_bits: i64

Methods

fn name(self: &FieldInfo) -> StringView

Returns the field’s name.

fn type_name(self: &FieldInfo) -> StringView

Returns the name of the field’s type (primitives as spelled, named types by bare name); types the emitter cannot name read as "?".

structFieldsView

struct FieldsView

Array view over a TypeInfo’s field descriptors, obtained via TypeInfo::fields.

Fields

arr_bits: i64
info: WritStatic

Methods

fn get(self: &FieldsView, idx: u64) -> FieldInfo

Returns the field descriptor at index idx.

fn len(self: &FieldsView) -> u64

Returns the number of field descriptors.

structTypeInfo

struct TypeInfo

Typed view over the static reflection blob emitted by reflect::<T>().

Fields

inner: WritStatic

Methods

fn annotation_count(self: &TypeInfo) -> u64

Returns the number of annotation instances, without constructing an AnnotationsView.

fn annotations(self: &TypeInfo) -> AnnotationsView

Returns a view over the annotation instances attached to the type.

fn field_count(self: &TypeInfo) -> u64

Returns the number of fields, without constructing a FieldsView.

fn fields(self: &TypeInfo) -> FieldsView

Returns a view over the type’s field descriptors.

fn is_data_plain(self: &TypeInfo) -> bool

Returns true for DataPlain types: no relative-pointer (zone-offset) fields, directly or transitively.

fn is_datatype(self: &TypeInfo) -> bool

Returns true if the reflected type is a datatype (zoned struct), i.e. kind() == 2.

fn kind(self: &TypeInfo) -> i64

Returns the type-kind code: 1 = plain struct, 2 = datatype (zoned struct), 3 = trait.

fn name(self: &TypeInfo) -> StringView

Returns the type’s unqualified name; the declaring package is read via pkg.

fn pkg(self: &TypeInfo) -> StringView

Returns the name of the package the type is declared in.

fn type_code(self: &TypeInfo) -> u64

Returns the compiler-assigned unique type code for this type.

Functions

fnmake

fn make() -> TypeInfo

Creates the TypeInfo for type _T via reflect::<_T>().