Skip to main content

DeserStrategy

Enum DeserStrategy 

Source
pub enum DeserStrategy {
Show 19 variants ContainerProxy, FieldProxy, Pointer { pointee_node: NodeId, }, OpaquePointer, Opaque, TransparentConvert { inner_node: NodeId, }, Scalar { scalar_type: Option<ScalarType>, is_from_str: bool, }, Struct, Tuple { field_count: usize, is_single_field_transparent: bool, }, Enum, Option { some_node: NodeId, }, Result { ok_node: NodeId, err_node: NodeId, }, List { item_node: NodeId, is_byte_vec: bool, }, Map { key_node: NodeId, value_node: NodeId, }, Set { item_node: NodeId, }, Array { len: usize, item_node: NodeId, }, DynamicValue, MetadataContainer, BackRef { target_type_id: ConstTypeId, },
}
Expand description

Precomputed deserialization strategy with all data needed to execute it.

This is denormalized: we store node indices, proxy defs, etc. directly so the deserializer can follow the plan without chasing pointers through Shape/vtable.

Variants§

§

ContainerProxy

Container-level proxy: the type itself has #[facet(proxy = X)] or format-specific proxies.

The actual proxy definition and node are looked up at runtime via:

  • shape.effective_proxy(format_namespace) for the ProxyDef
  • node.proxies.node_for(format_namespace) for the TypePlan node
§

FieldProxy

Field-level proxy: the field has #[facet(proxy = X)] but the type doesn’t.

The actual proxy definition and node are looked up at runtime via:

  • field.effective_proxy(format_namespace) for the ProxyDef
  • node.proxies.node_for(format_namespace) for the TypePlan node (from parent’s FieldPlan)
§

Pointer

Smart pointer (Box, Arc, Rc) with known pointee type

Fields

§pointee_node: NodeId

The pointee type’s plan

§

OpaquePointer

Opaque smart pointer (#[facet(opaque)]) - cannot be deserialized, only set wholesale

§

Opaque

Opaque type (Opaque<T>) - cannot be deserialized, only set wholesale via proxy

§

TransparentConvert

Transparent wrapper with try_from (like NonZero)

Fields

§inner_node: NodeId

The inner type’s plan

§

Scalar

Scalar with FromStr

Fields

§scalar_type: Option<ScalarType>

Precomputed scalar type for fast hint dispatch. None for opaque scalars that need parser-specific handling.

§is_from_str: bool

Whether this scalar type implements FromStr (for string parsing fallback)

§

Struct

Named struct

§

Tuple

Tuple or tuple struct

Fields

§field_count: usize

Number of fields in the tuple

§is_single_field_transparent: bool

Whether this is a single-field transparent wrapper that can accept values directly

§

Enum

Enum

§

Option

Option<T>

Fields

§some_node: NodeId

The Some variant’s inner type plan

§

Result

Result<T, E>

Fields

§ok_node: NodeId

The Ok variant’s type plan

§err_node: NodeId

The Err variant’s type plan

§

List

List (Vec, VecDeque, etc.)

Fields

§item_node: NodeId

The item type’s plan

§is_byte_vec: bool

Whether this is specifically Vec<u8> (for optimized byte sequence handling)

§

Map

Map (HashMap, BTreeMap, etc.)

Fields

§key_node: NodeId

The key type’s plan

§value_node: NodeId

The value type’s plan

§

Set

Set (HashSet, BTreeSet, etc.)

Fields

§item_node: NodeId

The item type’s plan

§

Array

Fixed-size array [T; N]

Fields

§len: usize

Array length

§item_node: NodeId

The item type’s plan

§

DynamicValue

DynamicValue (like facet_value::Value)

§

MetadataContainer

Metadata container (like Spanned<T>, Documented<T>) These require special field-by-field handling for metadata population

§

BackRef

BackRef to recursive type - resolved via TypePlan::resolve_backref()

Fields

§target_type_id: ConstTypeId

The TypeId of the target node

Trait Implementations§

Source§

impl Debug for DeserStrategy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.