Expand description
facet-core
Logo by Misiasart
Thanks to all individual and corporate sponsors, without whom this work could not exist:
Defines the core types and traits used throughout the facet ecosystem for runtime reflection:
Facet: exposes aSHAPEassociated constShape: The central type that describes the memory layout and capabilities of a type- Various vtables that define how to manipulate types at runtime
- The
Deftree, which describes type definitions (structs, enums, etc.)
This crate is foundational to facet’s reflection capabilities, providing the type system that enables runtime type manipulation.
Modules§
- spez
- Auto-deref specialization helpers for the Facet reflection system
Macros§
- value_
vtable - Creates a
ValueVTablefor a given type.
Structs§
- Bool
Affinity - Definition for boolean scalar affinities
- Bool
Affinity Builder - Builder for BoolAffinity
- Char
Affinity - Definition for character scalar affinities
- Char
Affinity Builder - Builder for CharAffinity
- Const
Type Id - TypeId equivalent usable in const contexts.
- Empty
Affinity - Definition for empty scalar affinities
- Empty
Affinity Builder - Builder for EmptyAffinity
- EnumDef
- Fields for enum types
- Enum
DefBuilder - Builder for EnumDef
- Field
- Describes a field in a struct or tuple
- Field
Builder - Builder for Field
- Field
Flags - Flags that can be applied to fields to modify their behavior
- Hasher
Proxy - Provides an implementation of
core::hash::Hasherfor a given hasher pointer and write function - IpAddr
Affinity - Definition for IP address scalar affinities
- IpAddr
Affinity Builder - Builder for IpAddrAffinity
- ListDef
- Fields for list types
- List
DefBuilder - Builder for ListDef
- ListV
Table - Virtual table for a list-like type (like
Vec<T>, but alsoHashSet<T>, etc.) - ListV
Table Builder - Builds a
ListVTable - Lock
GuardV Table - Functions for manipulating a guard
- Lock
Result - Type-erased result of locking a mutex-like smart pointer
- MapDef
- Fields for map types
- MapDef
Builder - Builder for MapDef
- MapIterV
Table - VTable for an iterator over a map
- MapIterV
Table Builder - Builds a
MapIterVTable - MapV
Table - Virtual table for a Map<K, V>
- MapV
Table Builder - Builds a
MapVTable - Marker
Traits - Bitflags for common marker traits that a type may implement
- Number
Affinity - Definition for number-like scalar affinities
- Number
Affinity Builder - Builder for NumberAffinity
- Opaque
- A type-erased pointer to an initialized value
- Opaque
Affinity - Definition for opaque scalar affinities
- Opaque
Affinity Builder - Builder for OpaqueAffinity
- Opaque
Const - A type-erased read-only pointer to an initialized value.
- Opaque
Uninit - A type-erased pointer to an uninitialized value
- Option
Def - Describes an Option — including a vtable to query and alter its state,
and the inner shape (the
TinOption<T>). - Option
DefBuilder - Builder for OptionDef
- OptionV
Table - Virtual table for
Option<T> - OptionV
Table Builder - Builds an
OptionVTable - Other
Affinity - Definition for other scalar affinities
- Other
Affinity Builder - Builder for OtherAffinity
- Scalar
Def - Definition for scalar types
- Scalar
DefBuilder - Builder for ScalarDef
- Shape
- Schema for reflection of a type
- Shape
Builder - Builder for
Shape - Smart
Pointer Def - Describes a smart pointer — including a vtable to query and alter its state,
and the inner shape (the
TinOption<T>). - Smart
Pointer DefBuilder - Builder for creating a
SmartPointerDef. - Smart
Pointer Flags - Flags to represent various characteristics of smart pointers
- Smart
PointerV Table - Functions for interacting with a smart pointer
- Smart
PointerV Table Builder - Builder for creating a
SmartPointerVTable. - Socket
Addr Affinity - Definition for socket address scalar affinities
- Socket
Addr Affinity Builder - Builder for SocketAddrAffinity
- String
Affinity - Definition for string-like scalar affinities
- String
Affinity Builder - Builder for StringAffinity
- Struct
Def - Common fields for struct-like types
- Struct
DefBuilder - Builder for StructDef
- Type
Name Opts - Options for formatting the name of a type
- ValueV
Table - VTable for common operations that can be performed on any shape
- ValueV
Table Builder - Builds a
ValueVTable - Variant
- Describes a variant of an enum
- Variant
Builder - Builder for Variant
Enums§
- Characteristic
- A characteristic a shape can have
- Def
- The definition of a shape: is it more like a struct, a map, a list?
- Enum
Repr - All possible representations for Rust enums
- Field
Attribute - An attribute that can be set on a field
- Field
Error - Errors encountered when calling
field_by_indexorfield_by_name - Known
Smart Pointer - Represents common standard library smart pointer kinds
- Number
Bits - Bit representation of numbers
- Parse
Error - Error returned by
ParseFn - Scalar
Affinity - Scalar affinity: what a scalar spiritually is: a number, a string, a bool, something else entirely?
- Signedness
- Represents whether a numeric type is signed or unsigned
- Struct
Kind - Describes the kind of struct (useful for deserializing)
- TryFrom
Error - Error type for TryFrom conversion failures
- Variant
Kind - Represents the different kinds of variants that can exist in a Rust enum
Traits§
- Facet
- Allows querying the
Shapeof a type, which in turn lets us inspect any fields, build a value of this type progressively, etc.
Functions§
Type Aliases§
- Borrow
Fn - Tries to obtain a reference to the inner value of the smart pointer.
- Clone
Into Fn - Function to clone a value into another already-allocated value
- CmpFn
- Function to compare two values and return their ordering
- DebugFn
- Function to format a value for debug. If this returns None, the shape did not implement Debug.
- Default
InPlace Fn - Function to set a value to its default in-place
- Display
Fn - Function to format a value for display
- Downgrade
Fn - Downgrades a strong pointer to a weak one.
- Drop
InPlace Fn - Function to drop a value
- HashFn
- Function to hash a value
- Hasher
Write Fn - Function to write bytes to a hasher
- List
GetItem PtrFn - Get pointer to the item at the given index. Panics if out of bounds.
- List
Init InPlace With Capacity Fn - Initialize a list in place with a given capacity
- List
LenFn - Get the number of items in the list
- List
Push Fn - Push an item to the list
- LockFn
- Acquires a lock on a mutex-like smart pointer
- MapContains
KeyFn - Check if the map contains a key
- MapGet
Value PtrFn - Get pointer to a value for a given key, returns None if not found
- MapInit
InPlace With Capacity Fn - Initialize a map in place with a given capacity
- MapInsert
Fn - Insert a key-value pair into the map
- MapIter
Dealloc Fn - Deallocate the iterator
- MapIter
Fn - Get an iterator over the map
- MapIter
Next Fn - Get the next key-value pair from the iterator
- MapLen
Fn - Get the number of entries in the map
- NewInto
Fn - Creates a new smart pointer wrapping the given value. Writes the smart pointer
into the given
this. - Option
GetValue Fn - Get the value contained in an option, if present
- Option
Init None Fn - Initialize an option with None
- Option
Init Some Fn - Initialize an option with Some(value)
- Option
IsSome Fn - Check if an option contains a value
- Option
Replace With Fn - Replace an existing option with a new value
- ParseFn
- Function to parse a value from a string.
- Partial
EqFn - Function to check if two values are partially equal
- Partial
OrdFn - Function to compare two values and return their ordering if comparable
- ReadFn
- Acquires a read lock on a reader-writer lock-like smart pointer
- TryFrom
Fn - Function to try converting from another type
- TryUpgrade
Fn - Tries to upgrade the weak pointer to a strong one.
- Type
Name Fn - A function that formats the name of a type.
- WriteFn
- Acquires a write lock on a reader-writer lock-like smart pointer