Crate facet_reflect

Source
Expand description

The facet-reflect crate provides utilities for inspecting and manipulating data structures.

This crate combines functionality that was previously split between separate crates:

  • Peeking: Reading or inspecting data structures
  • Poking: Modifying or manipulating data structures

Both capabilities are essential for reflection operations in the Facet ecosystem.

Structs§

Guard
Ensures a value is dropped when the guard is dropped.
ISet
Keeps track of which fields were initialized, up to 64 fields
PeekEnum
Lets you read from an enum (implements read-only enum operations)
PeekList
Lets you read from a list (implements read-only facet_core::ListVTable proxies)
PeekListIter
Iterator over a PeekList
PeekMap
Lets you read from a map (implements read-only facet_core::MapVTable proxies)
PeekMapIter
Iterator over key-value pairs in a PeekMap
PeekOption
Lets you read from an option (implements read-only option operations)
PeekStruct
Lets you read from a struct (implements read-only struct operations)
PeekValue
Lets you read from a value (implements read-only ValueVTable proxies)
PokeEnum
Allows poking an enum with a selected variant (setting fields, etc.)
PokeEnumNoVariant
Represents an enum before a variant has been selected
PokeList
Allows poking a list (appending, etc.)
PokeListUninit
Allows initializing an uninitialized list
PokeMap
Allows poking a map (inserting, etc.)
PokeMapUninit
Allows initializing an uninitialized map
PokeOption
Allows poking an option (setting Some/None)
PokeOptionUninit
Allows initializing an uninitialized option
PokeSmartPointer
PokeSmartPointerReadGuard
PokeSmartPointerUninit
Allows initializing an uninitialized option
PokeSmartPointerWriteGuard
PokeStruct
Allows poking a struct (setting fields, etc.)
PokeValue
Lets you modify an initialized value (implements read-write ValueVTable proxies)
PokeValueUninit
Lets you write to a value (implements write-only ValueVTable proxies)
TypedPokeValue
A strongly-typed value writer for initialized values that ensures type safety at compile-time
TypedPokeValueUninit
A strongly-typed value writer that ensures type safety at compile-time

Enums§

Peek
Lets you peek at the innards of a value
Poke
Allows manipulating already-initialized values of different kinds.
PokeUninit
Allows initializing values of different kinds.
ScalarType
All scalar types supported out of the box by peek and poke.
VariantError
All possible errors when getting a variant by index or by name

Functions§

peek_enum
Returns the enum definition if the shape represents an enum, None otherwise
peek_enum_repr
Returns the enum representation if the shape represents an enum, None otherwise
peek_enum_variants
Returns the enum variants if the shape represents an enum, None otherwise
peek_option
Returns the option definition if the shape represents an option, None otherwise