Expand description
§facet-reflect
Whereas the core facet crate provides essential traits like Facet itself, and
data structures like Type, StructType, Field, etc., facet-reflect uses that
information about the shape of types to allow:
- Read-only access to already-initialized values (via
Peek) - Construction of values from scratch (via
Partial)
This allows, respectively, serialization and deserialization, without risking breaking
invariants in types that implement Facet.
§Sponsors
Thanks to all individual sponsors:
…along with corporate sponsors:
…without whom this work could not exist.
§Special thanks
The facet logo was drawn by Misiasart.
§License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Modules§
- deferred_
materialization - Deferred Materialization
Macros§
- debug
- Forwards to log::debug when the log feature is enabled
- trace
- Forwards to log::trace when the log feature is enabled
Structs§
- Covariant
Peek - A covariant wrapper around
Peekfor types that are covariant over their lifetime parameter. - Duplicate
Field Error - Error when building a resolution.
- Field
Info - Information about a single field in a resolution.
- Field
Item - A field item with runtime state for serialization.
- Field
Iter - An iterator over all the fields of a struct or enum. See
HasFields::fields - Field
Path - A path through the type tree to a field.
- Fields
ForSerialize Iter - An iterator over the fields of a struct or enum that should be serialized. See
HasFields::fields_for_serialize - Guard
- A guard structure to manage memory allocation and deallocation.
- Heap
Value - A type-erased value stored on the heap
- Owned
Peek - An Owned version of a Peek used for custom serialization
- Partial
- A type-erased, heap-allocated, partially-initialized value.
- Peek
- A read-only view into a value with runtime type information.
- Peek
Dynamic Value - Lets you read from a dynamic value (implements read-only operations for DynamicValue types)
- Peek
Dynamic Value Array Iter - Iterator over array elements in a dynamic value
- Peek
Dynamic Value Object Iter - Iterator over object entries in a dynamic value
- Peek
Enum - Lets you read from an enum (implements read-only enum operations)
- Peek
List - Lets you read from a list (implements read-only
facet_core::ListVTableproxies) - Peek
List Iter - Iterator over a
PeekList - Peek
List Like - Lets you read from a list, array or slice
- Peek
List Like Iter - Iterator over a
PeekListLike - PeekMap
- Lets you read from a map (implements read-only
facet_core::MapVTableproxies) - Peek
MapIter - Iterator over key-value pairs in a
PeekMap - Peek
NdArray - Lets you read from an n-dimensional array (implements read-only
facet_core::NdArrayVTableproxies) - Peek
Option - Lets you read from an option (implements read-only option operations)
- Peek
Pointer - Represents a pointer that can be peeked at during memory inspection.
- Peek
Result - Lets you read from a result (implements read-only result operations)
- PeekSet
- Lets you read from a set
- Peek
SetIter - Iterator over values in a
PeekSet - Peek
Struct - Lets you read from a struct (implements read-only struct operations)
- Peek
Tuple - Lets you read from a tuple
- Poke
- A mutable view into a value with runtime type information.
- Poke
Enum - Lets you mutate an enum’s fields.
- Poke
Struct - Lets you mutate a struct’s fields.
- Resolution
- One possible “shape” the flattened type could take.
- Span
- Source span with offset and length.
- Spanned
- A value with source span information.
- Tuple
Type - Local representation of a tuple type for peek operations
- ValueId
- A unique identifier for a peek value
- Variant
Selection - Records that a specific enum field has a specific variant selected.
Enums§
- List
Like Def - Fields for types which act like lists
- Match
Result - Result of matching input fields against a resolution.
- Path
Segment - A segment in a field path.
- Reflect
Error - Errors that can occur when reflecting on types.
- Scalar
Type - All scalar types supported out of the box by facet.
- Stride
Error - Error that can occur when trying to access an n-dimensional array as strided
- Tracker
Kind - A kind-only version of Tracker
- Variant
Error - Error that can occur when trying to determine variant information
Traits§
- HasFields
- Trait for types that have field methods
Functions§
- find_
span_ metadata_ field - Find the span metadata field in a struct shape.
- get_
spanned_ inner_ shape - Extract the inner value shape from a Spanned-like struct.
- is_
spanned_ shape - Check if a shape represents a type with span metadata (like
Spanned<T>). - 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
Type Aliases§
- KeyPath
- A path of serialized key names for probing. Unlike FieldPath which tracks the internal type structure (including variant selections), KeyPath only tracks the keys as they appear in the serialized format.
- Tuple
Field - Field index and associated peek value