Crate facet_reflect

Crate facet_reflect 

Source
Expand description

§facet-reflect

Coverage Status crates.io documentation MIT/Apache-2.0 licensed Discord

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:

GitHub Sponsors Patreon

…along with corporate sponsors:

AWS Zed Depot

…without whom this work could not exist.

§Special thanks

The facet logo was drawn by Misiasart.

§License

Licensed under either of:

at your option.

Macros§

debug
Forwards to log::debug when the log feature is enabled
trace
Forwards to log::trace when the log feature is enabled

Structs§

FieldIter
An iterator over all the fields of a struct or enum. See HasFields::fields
FieldsForSerializeIter
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.
HeapValue
A type-erased value stored on the heap
Partial
A type-erased, heap-allocated, partially-initialized value.
Peek
Lets you read from a value (implements read-only ValueVTable proxies)
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
PeekListLike
Lets you read from a list, array or slice
PeekListLikeIter
Iterator over a PeekListLike
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)
PeekPointer
Represents a pointer that can be peeked at during memory inspection.
PeekSet
Lets you read from a set
PeekSetIter
Iterator over values in a PeekSet
PeekStruct
Lets you read from a struct (implements read-only struct operations)
PeekTuple
Lets you read from a tuple
TupleType
Local representation of a tuple type for peek operations
TypedPartial
A typed wrapper around Partial, for when you want to statically ensure that build gives you the proper type.
ValueId
A unique identifier for a peek value

Enums§

ListLikeDef
Fields for types which act like lists
ReflectError
Errors that can occur when reflecting on types.
ScalarType
All scalar types supported out of the box by peek and poke.
TrackerKind
A kind-only version of Tracker
VariantError
Error that can occur when trying to determine variant information

Traits§

HasFields
Trait for types that have field methods

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

Type Aliases§

TupleField
Field index and associated peek value