Resolution

Struct Resolution 

Source
pub struct Resolution { /* private fields */ }
Expand description

One possible “shape” the flattened type could take.

Represents a specific choice of variants for all enums in the flatten tree. This is the “resolution” of all ambiguity in the type — all enum variants have been selected, all fields are known.

Implementations§

Source§

impl Resolution

Source

pub fn new() -> Resolution

Create a new empty resolution.

Source

pub fn add_key_path(&mut self, path: Vec<&'static str>)

Add a key path (for depth-aware probing).

Source

pub fn add_field(&mut self, info: FieldInfo) -> Result<(), DuplicateFieldError>

Add a field to this resolution.

Returns an error if a field with the same serialized name already exists but comes from a different source (different path). This catches duplicate field name conflicts between parent structs and flattened fields.

Source

pub fn add_variant_selection( &mut self, path: FieldPath, enum_name: &'static str, variant_name: &'static str, )

Add a variant selection to this resolution.

Source

pub fn merge(&mut self, other: &Resolution) -> Result<(), DuplicateFieldError>

Merge another resolution into this one.

Returns an error if a field with the same serialized name already exists but comes from a different source (different path). This catches duplicate field name conflicts between parent structs and flattened fields.

Source

pub fn mark_all_optional(&mut self)

Mark all fields as optional (required = false). Used when a flattened field is wrapped in Option<T>.

Source

pub fn matches(&self, input_fields: &BTreeSet<Cow<'_, str>>) -> MatchResult

Check if this resolution matches the input fields.

Source

pub fn describe(&self) -> String

Get a human-readable description of this resolution.

Returns something like MessagePayload::Text or Auth::Token + Transport::Tcp for resolutions with multiple variant selections.

Source

pub fn deserialization_order(&self) -> Vec<&FieldInfo>

Get the fields in deserialization order (deepest first).

Source

pub fn field(&self, name: &str) -> Option<&FieldInfo>

Get a field by name.

Source

pub fn fields(&self) -> &BTreeMap<&'static str, FieldInfo>

Get all fields.

Source

pub fn required_field_names(&self) -> &BTreeSet<&'static str>

Get the set of required field names.

Source

pub fn missing_optional_fields<'a>( &'a self, seen_keys: &'a BTreeSet<Cow<'_, str>>, ) -> impl Iterator<Item = &'a FieldInfo>

Get optional fields that were NOT provided in the input.

This is useful for deserializers that need to initialize missing optional fields to None or their default value.

Source

pub fn variant_selections(&self) -> &[VariantSelection]

Get variant selections.

Source

pub fn child_fields(&self) -> impl Iterator<Item = &FieldInfo>

Get all child fields (fields with the CHILD flag).

This is useful for KDL deserialization where child nodes need to be processed separately from properties.

Source

pub fn property_fields(&self) -> impl Iterator<Item = &FieldInfo>

Get all property fields (fields without the child attribute).

This is useful for KDL deserialization where properties are processed separately from child nodes.

Source

pub fn known_paths(&self) -> &BTreeSet<Vec<&'static str>>

Get all known key paths (for depth-aware probing).

Source

pub fn has_key_path(&self, path: &[&str]) -> bool

Check if this resolution has a specific key path. Compares runtime strings against static schema paths.

Trait Implementations§

Source§

impl Clone for Resolution

Source§

fn clone(&self) -> Resolution

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Resolution

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Resolution

Source§

fn default() -> Resolution

Returns the “default value” for a type. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.