Expand description
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.
§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§
- spez
- Auto-deref specialization helpers for the Facet reflection system
Macros§
- value_
vtable - Creates a
ValueVTablefor a given type. - value_
vtable_ unsized - Similar to
value_vtable!macro but for!Sizedtypes.
Structs§
- Array
Def - Fields for array types
- Array
DefBuilder - Builder for ArrayDef
- Array
Type - Describes a fixed-size array (
[T; N]) - ArrayV
Table - Virtual table for an array
- ArrayV
Table Builder - Builds a
ArrayVTable - 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
- Complex
Number Affinity - Definition for string-like scalar affinities
- Complex
Number Affinity Builder - Builder for ComplexNumberAffinity
- Const
Type Id - TypeId equivalent usable in const contexts.
- Empty
Affinity - Definition for empty scalar affinities
- Empty
Affinity Builder - Builder for EmptyAffinity
- Enum
DefBuilder - Builder for EnumDef
- Enum
Type - Fields for enum types
- 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
- FieldV
Table - Vtable for field-specific operations
- FieldV
Table Builder - Builder for FieldVTable
- Function
Pointer Def - Common fields for function pointer types
- Function
Pointer DefBuilder - Builder for FunctionPointerDef
- 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
- IterV
Table - VTable for an iterator
- IterV
Table Builder - Builds an
IterVTable - ListDef
- Fields for list types
- List
DefBuilder - Builder for ListDef
- ListV
Table - Virtual table for a list-like type (like
Vec<T>) - 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
- 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
- Helper type for opaque members
- Opaque
Affinity - Definition for opaque scalar affinities
- Opaque
Affinity Builder - Builder for OpaqueAffinity
- 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
- Path
Affinity - Definition for path scalar affinities
- Path
Affinity Builder - Builder for PathAffinity
- PtrConst
- A type-erased read-only pointer to an initialized value.
- PtrMut
- A type-erased pointer to an initialized value
- PtrUninit
- A type-erased pointer to an uninitialized value
- Repr
- Describes base representation of the type
- Scalar
Def - Definition for scalar types
- Scalar
DefBuilder - Builder for ScalarDef
- SetDef
- Fields for set types
- SetDef
Builder - Builder for SetDef
- SetV
Table - Virtual table for a
Set<T> - SetV
Table Builder - Builds a
SetVTable - Shape
- Schema for reflection of a type
- Shape
Builder - Builder for
Shape - Slice
Def - Fields for slice types
- Slice
DefBuilder - Builder for SliceDef
- Slice
Type - Describes a slice (
[T]) - SliceV
Table - Virtual table for a slice-like type (like
Vec<T>, but alsoHashSet<T>, etc.) - SliceV
Table Builder - Builds a
SliceVTable - Smart
Pointer Def - Describes a smart pointer — including a vtable to query and alter its state, and the inner shape (the pointee type in the smart pointer).
- 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
Builder - Builder for StructType
- Struct
Type - Common fields for struct-like types
- Time
Affinity - Definition for Datetime/Timestamp scalar affinities
- Time
Affinity Builder - Builder for UuidAffinity
- Type
Name Opts - Options for formatting the name of a type
- Type
Param - Represents a lifetime parameter, e.g.,
'aor'a: 'b + 'c. - Typed
PtrUninit - A pointer to an uninitialized value with a lifetime.
- Ulid
Affinity - Definition for ULID and ULID-like scalar affinities
- Ulid
Affinity Builder - Builder for UlidAffinity
- Union
Type - Common fields for union types
- Unsized
Error - Tried to get the
Layoutof an unsized type - UrlAffinity
- Definition for URL scalar affinities
- UrlAffinity
Builder - Builder for UrlAffinity
- Uuid
Affinity - Definition for UUID and UUID-like scalar affinities
- Uuid
Affinity Builder - Builder for UuidAffinity
- VTable
View - A typed view of a
ValueVTable. - Value
Pointer Type - Describes the raw/reference pointer
- ValueV
Table - VTable for common operations that can be performed on any shape
- ValueV
Table Builder - Builds a
ValueVTable - ValueV
Table Builder Unsized - Builds a
ValueVTablefor a!Sizedtype - Variant
- Describes a variant of an enum
- Variant
Builder - Builder for Variant
Enums§
- Base
Repr - Underlying byte layout representation
- Characteristic
- A characteristic a shape can have
- Def
- The semantic definition of a shape: is it more like a scalar, a map, a list?
- Enum
Repr - All possible representations for Rust enums — ie. the type/size of the discriminant
- Field
Attribute - An attribute that can be set on a field
- Field
Error - Errors encountered when calling
field_by_indexorfield_by_name - Function
Abi - The calling ABI of a function pointer
- Integer
Size - Size specification for integer types
- Known
Smart Pointer - Represents common standard library smart pointer kinds
- Number
Bits - Bit representation of numbers
- Numeric
Type - Describes numeric types (integer/float)
- Parse
Error - Error returned by
ParseFn - Pointer
Type - Describes all pointer types
- Primitive
Type - Describes built-in primitives (u32, bool, str, etc.)
- Scalar
Affinity - Scalar affinity: what a scalar spiritually is: a number, a string, a bool, something else entirely?
- Sequence
Type - Describes built-in sequence type (array, slice)
- Shape
Attribute - An attribute that can be applied to a shape
- Shape
Layout - Layout of the shape
- Signedness
- Represents whether a numeric type is signed or unsigned
- Struct
Kind - Describes the kind of struct (useful for deserializing)
- Textual
Type - Describes textual types (char/string)
- TryBorrow
Inner Error - Error type returned by
TryBorrowInnerFnwhen attempting to borrow the inner value from a wrapper type. - TryFrom
Error - Error type for TryFrom conversion failures
- TryInto
Inner Error - Error type returned by
TryIntoInnerFnwhen attempting to extract the inner value from a wrapper type. - Type
- The definition of a shape in accordance to rust reference:
- User
Type - User-defined types (structs, enums, unions)
- Variant
Attribute - An attribute that can be set on an enum variant
Traits§
- Facet
- Allows querying the
Shapeof a type, which in turn lets us inspect any fields, build a value of this type progressively, etc. - Iter
Item - A kind of item that an
IterVTablereturns
Functions§
Type Aliases§
- Array
AsMut PtrFn - Get mutable pointer to the data buffer of the array.
- Array
AsPtr Fn - Get pointer to the data buffer of the array.
- 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
- Clone
Into FnTyped - Function to clone a value into another already-allocated value
- CmpFn
- Function to compare two values and return their ordering
- CmpFn
Typed - 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.
- Debug
FnTyped - 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
- Default
InPlace FnTyped - Function to set a value to its default in-place
- Display
Fn - Function to format a value for display
- Display
FnTyped - Function to format a value for display
- Downgrade
Into Fn - Downgrades a strong pointer to a weak one.
- Drop
InPlace Fn - Function to drop a value
- HashFn
- Function to hash a value
- Hash
FnTyped - Function to hash a value
- Hasher
Write Fn - Function to write bytes to a hasher
- Hasher
Write FnTyped - Function to write bytes to a hasher
- Invariants
Fn - Function to validate the invariants of a value. If it returns false, the value is considered invalid.
- Invariants
FnTyped - Function to validate the invariants of a value. If it returns false, the value is considered invalid.
- Iter
Dealloc Fn - Deallocate the iterator
- Iter
Init With Value Fn - Create a new iterator that iterates over the provided value
- Iter
Next Back Fn - Advance the iterator in reverse, returning the next value from the end of the iterator.
- Iter
Next Fn - Advance the iterator, returning the next value from the iterator
- Iter
Size Hint Fn - Return the lower and upper bounds of the iterator, if known.
- List
AsMut PtrFn - Get mutable pointer to the data buffer of the list.
- List
AsPtr Fn - Get pointer to the data buffer of the list.
- List
GetFn - Get pointer to the element at
indexin the list, orNoneif the index is out of bounds. - List
GetMut Fn - Get mutable pointer to the element at
indexin the list, orNoneif the index is 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
- MapLen
Fn - Get the number of entries in the map
- NewInto
Fn - Creates a new smart pointer wrapping the given value.
- 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.
- Parse
FnTyped - Function to parse a value from a string.
- Partial
EqFn - Function to check if two values are partially equal
- Partial
EqFn Typed - Function to check if two values are partially equal
- Partial
OrdFn - Function to compare two values and return their ordering if comparable
- Partial
OrdFn Typed - Function to compare two values and return their ordering if comparable
- ReadFn
- Acquires a read lock on a reader-writer lock-like smart pointer
- SetContains
Fn - Check if the set contains a value
- SetInit
InPlace With Capacity Fn - Initialize a set in place with a given capacity
- SetInsert
Fn - Insert a value in the set if not already contained, returning true if the value wasn’t present before
- SetLen
Fn - Get the number of values in the set
- Skip
Serializing IfFn - A function that, if present, determines whether field should be included in the serialization step.
- Slice
AsMut PtrFn - Get mutable pointer to the data buffer of the slice
- Slice
AsPtr Fn - Get pointer to the data buffer of the slice
- Slice
LenFn - Get the number of items in the slice
- TryBorrow
Inner Fn - Function to borrow the inner value from a transparent/newtype wrapper without copying.
- TryBorrow
Inner FnTyped - Function to borrow the inner value from a transparent/newtype wrapper without copying.
- TryFrom
Fn - Function to try converting from another type
- TryFrom
FnTyped - Function to try converting from another type
- TryInto
Inner Fn - Function to convert a transparent/newtype wrapper into its inner type.
- TryInto
Inner FnTyped - Function to convert a transparent/newtype wrapper into its inner type.
- Type
Name Fn - A function that formats the name of a type.
- Upgrade
Into Fn - Tries to upgrade the weak pointer to a strong one.
- WriteFn
- Acquires a write lock on a reader-writer lock-like smart pointer