Operations
Returns the number of descriptors in the immutable loaded registry.
Module std.reflection
import std.reflection;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
RegisteredTypeCount
pub fn RegisteredTypeCount() -> usizeReturns the number of descriptors in the immutable loaded registry. Return: Deterministic registered-type count with no allocation.
RegisteredTypeAt
pub fn RegisteredTypeAt(Index: usize) -> TypeInfo?Selects one registered type by stable registry order. Index: Zero-based registry index. Return: Descriptor or none when out of range.
RegisteredAttributeSiteCount
pub fn RegisteredAttributeSiteCount() -> usizeCounts retained public attribute sites across the published registry. Return: Sparse site count.
RegisteredAttributeSiteAt
pub fn RegisteredAttributeSiteAt(Index: usize) -> AttributeSiteInfo?Selects a retained public attribute site. Index: Zero-based sparse ordinal. Return: Site or none.
FindType
pub fn FindType(
ModulePath: str,
QualifiedName: str
) -> Result<TypeInfo, LookupError>Finds one exact type name within one exact module path. ModulePath: Exact registered UTF-8 module path. QualifiedName: Exact registered UTF-8 qualified type name. Return: Descriptor, NotFound, or Ambiguous after exact byte comparison.
FindTypeByStableId
pub fn FindTypeByStableId(
Value: StableTypeId
) -> Result<TypeInfo, LookupError>Finds one exact registered stable semantic identity. Value: Complete 128-bit StableTypeId. Return: Descriptor, NotFound, or Ambiguous collision error.
TypeOf
pub fn TypeOf<T>() -> TypeInfoReturns the exact descriptor for one compile-time type argument. T: Exact semantic type whose published descriptor is requested. Return: Nonowning TypeInfo valid for the process or owning JIT session.
TypeOf
pub fn TypeOf<T>(Value: readonly T&) -> TypeInfoReturns the actual type of one live value through a read-only borrow.
An inheritable class or interface view reports the instantiated concrete type, including when the borrow is typed as a base. An exact data value reports its declared type. This query does not allocate or require rich member reflection; an opaque TypeInfo still carries identity and layout. T: Static type of the borrowed place. Value: Live place whose borrow remains valid for this call. Return: Nonowning TypeInfo for the actual instantiated value.
TypeOf
pub unsafe fn TypeOf<T>(Value: readonly T*) -> TypeInfo?Returns the actual pointee type of one typed raw pointer.
A null pointer returns none. The caller must establish that a nonnull pointer addresses a live T object; null checking cannot establish lifetime. This query does not allocate or require rich member reflection. T: Static pointee type. Value: Nullable pointer to a live T object when nonnull. Return: Actual instantiated pointee type, or none for null. Pre: A nonnull Value is aligned and valid for a read of its pointee.
Erase
pub fn Erase<T>(Value: readonly T&) -> ValueRefErases one read-only lvalue place without boxing or copying. T: Exact static place type. Value: Lvalue borrow retained only through the returned view's uses. Return: Read-access ValueRef tied to the place lifetime.
Erase
pub fn Erase<T>(Value: mut T&) -> ValueRefErases one writable lvalue place without boxing or copying. T: Exact static place type. Value: Writable lvalue borrow retained only through returned view uses. Return: Write-access ValueRef tied to the place lifetime.
EraseForeign
pub unsafe fn EraseForeign(Address: void*, Type: TypeInfo) -> ValueRefCreates a read-only erased view from a foreign raw address. Address: Address of one live exact-type foreign value. Type: Exact matching descriptor. Return: Read-access ValueRef with no ownership or lifetime extension. Pre: Safety: Address is nonnull, aligned, live as exactly Type, and remains so without conflicting mutation for every use of the result.
EraseForeignMut
pub unsafe fn EraseForeignMut(
Address: mut void*,
Type: TypeInfo
) -> ValueRefCreates a writable erased view from a foreign raw address. Address: Address of one live exact-type writable foreign value. Type: Exact matching descriptor. Return: Write-access ValueRef with no ownership or lifetime extension. Pre: Safety: Address is nonnull/aligned/live as exactly Type and caller holds sufficient writable access without conflicting aliases for every use.
SlotFromStorage
pub unsafe fn SlotFromStorage(
Address: mut void*,
Type: TypeInfo,
Capacity: usize,
Alignment: usize,
State: ValueSlotState
) -> ValueSlotWraps caller-owned raw storage as an Empty or Live reflected slot. Address: Writable storage base. Type: Exact value descriptor. Capacity: Writable byte extent. Alignment: Actual guaranteed byte alignment. State: Whether one exact live value already occupies storage. Return: Non-owning non-Copy slot wrapper. Pre: Safety: storage remains live through all slot uses; Capacity/Alignment are truthful, and Live means a valid exact Type value exists at Address.
DestroySlot
pub fn DestroySlot(Value: mut ValueSlot&) -> InvocationStatusDestroys a Live slot value and transitions it to Empty. Value: Writable caller-owned slot wrapper. Return: Success or validation status; failure changes nothing.
CopySlot
pub fn CopySlot<T>(
Value: readonly ValueSlot&
) -> Result<T, InvocationStatus>
where T: CopyableCopies an exact Copyable slot value without changing slot state. T: Exact expected Copyable value type. Value: Read-only Live slot wrapper. Return: Copied T or validation status; slot remains Live.
TakeSlot
pub fn TakeSlot<T>(
Value: mut ValueSlot&
) -> Result<T, InvocationStatus>
where T: MovableTransfers an exact Movable slot value and transitions slot to Empty. T: Exact expected Movable value type. Value: Writable Live slot wrapper. The selected move runs before destruction of the moved-from slot value. No default constructor is required. Return: Transferred T or validation status; failure changes nothing.
ReadField
pub fn ReadField(
Field: FieldInfo,
Instance: ValueRef?,
Result: mut ValueSlot&,
Access: PrivateAccess
) -> InvocationStatusReads one static or instance field into caller-owned Empty storage. Field: Exact field descriptor. Instance: None only for a static field; exact instance otherwise. Result: Writable Empty result slot. Access: Explicit private-operation authority. Return: Checked status; non-Success changes nothing.
WriteField
pub fn WriteField(
Field: FieldInfo,
Instance: ValueRef?,
Value: readonly Argument&,
Access: PrivateAccess
) -> InvocationStatusWrites one static or instance field from one delayed Argument. Field: Exact field descriptor. Instance: None only for a static field; exact instance otherwise. Value: Borrowed operation record. Access: Explicit private-operation authority. Return: Checked status; non-Success changes nothing.
ReadProperty
pub fn ReadProperty(
Property: PropertyInfo,
Instance: ValueRef,
Result: mut ValueSlot&,
Access: PrivateAccess
) -> InvocationStatusInvokes one property getter into caller-owned Empty storage. Property: Exact instance property descriptor. Instance: Exact receiver view. Result: Writable Empty result slot. Access: Explicit private-operation authority. Return: Checked status; non-Success changes nothing.
WriteProperty
pub fn WriteProperty(
Property: PropertyInfo,
Instance: ValueRef,
Value: readonly Argument&,
Access: PrivateAccess
) -> InvocationStatusInvokes one property setter from one delayed Argument. Property: Exact instance property descriptor. Instance: Exact writable receiver view. Value: Borrowed operation record. Access: Explicit private-operation authority. Return: Checked status; missing setter reports AccessMismatch.
Invoke
pub fn Invoke(
Method: MethodInfo,
Frame: mut InvocationFrame&
) -> InvocationStatusValidates and invokes one exact reflected typed method adapter. Method: Exact published method descriptor. Frame: Writable nonowning frame and caller-owned slots. Return: Success after normal return, or validation status before effects. Warning: A called Sn panic remains fatal and is never converted to status.