Crate facet_types

Crate facet_types 

Source
Expand description

Facet logo - a reflection library for Rust   facet-types

experimental free of syn crates.io documentation MIT/Apache-2.0 licensed

Thanks to all individual and corporate sponsors, without whom this work could not exist:

Ko-fi GitHub Sponsors Patreon Zed

Defines the core types used throughout the facet ecosystem for runtime reflection:

  • Shape: The central type that describes the memory layout and capabilities of a type
  • Various vtables that define how to manipulate types at runtime
  • The Def tree, which describes type definitions (structs, enums, etc.)

This crate is foundational to facet’s reflection capabilities, providing the type system that enables safe runtime type manipulation.

§Key Components

  • Memory layout information (size, alignment, etc.)
  • Type definition hierarchies
  • Runtime type manipulation vtables
  • Safe type erasure primitives

§License

Licensed under either of:

at your option. structs and vtable definitions used by Facet

Structs§

EnumDef
Fields for enum types
EnumDefBuilder
Builder for EnumDef
Field
Describes a field in a struct or tuple
FieldBuilder
Builder for Field
FieldFlags
Flags that can be applied to fields to modify their behavior
HasherProxy
Provides an implementation of core::hash::Hasher for a given hasher pointer and write function
ListDef
Fields for list types
ListDefBuilder
Builder for ListDef
ListVTable
Virtual table for a list-like type (like Vec<T>, but also HashSet<T>, etc.)
ListVTableBuilder
Builds a ListVTable
MapDef
Fields for map types
MapDefBuilder
Builder for MapDef
MapIterVTable
VTable for an iterator over a map
MapIterVTableBuilder
Builds a MapIterVTable
MapVTable
Virtual table for a Map<K, V>
MapVTableBuilder
Builds a MapVTable
MarkerTraits
Bitflags for common marker traits that a type may implement
ScalarDef
Definition for scalar types
ScalarDefBuilder
Builder for ScalarDef
Shape
Schema for reflection of a type
ShapeBuilder
Builder for Shape
StructDef
Common fields for struct-like types
StructDefBuilder
Builder for StructDef
TypeNameOpts
Options for formatting the name of a type
ValueVTable
VTable for common operations that can be performed on any shape
ValueVTableBuilder
Builds a ValueVTable
Variant
Describes a variant of an enum
VariantBuilder
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?
EnumRepr
All possible representations for Rust enums
FieldAttribute
An attribute that can be set on a field
FieldError
Errors encountered when calling field_by_index or field_by_name
ParseError
Error returned by ParseFn
StructKind
Describes the kind of struct (useful for deserializing)
TryFromError
Error type for TryFrom conversion failures
VariantKind
Represents the different kinds of variants that can exist in a Rust enum

Functions§

clone_into_fn_for
Generates a [CloneInPlaceFn] for a concrete type
cmp_fn_for
Generates a CmpFn for a concrete type
debug_fn_for
Generates a DebugFn for a concrete type
default_in_place_fn_for
Generates a DefaultInPlaceFn for a concrete type
display_fn_for
Generates a DisplayFn for a concrete type
drop_in_place_fn_for
Generates a DropInPlaceFn for a concrete type
hash_fn_for
Generates a HashFn for a concrete type
parse_fn_for
Generates a ParseFn for a concrete type
partial_eq_fn_for
Generates a PartialEqFn for a concrete type
partial_ord_fn_for
Generates a PartialOrdFn for a concrete type

Type Aliases§

CloneIntoFn
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.
DefaultInPlaceFn
Function to set a value to its default in-place
DisplayFn
Function to format a value for display
DropInPlaceFn
Function to drop a value
HashFn
Function to hash a value
HasherWriteFn
Function to write bytes to a hasher
ListGetItemPtrFn
Get pointer to the item at the given index. Panics if out of bounds.
ListInitInPlaceWithCapacityFn
Initialize a list in place with a given capacity
ListLenFn
Get the number of items in the list
ListPushFn
Push an item to the list
MapContainsKeyFn
Check if the map contains a key
MapGetValuePtrFn
Get pointer to a value for a given key, returns None if not found
MapInitInPlaceWithCapacityFn
Initialize a map in place with a given capacity
MapInsertFn
Insert a key-value pair into the map
MapIterDeallocFn
Deallocate the iterator
MapIterFn
Get an iterator over the map
MapIterNextFn
Get the next key-value pair from the iterator
MapLenFn
Get the number of entries in the map
ParseFn
Function to parse a value from a string.
PartialEqFn
Function to check if two values are partially equal
PartialOrdFn
Function to compare two values and return their ordering if comparable
TryFromFn
Function to try converting from another type
TypeNameFn
A function that formats the name of a type.