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
impl Resolution
Sourcepub fn new() -> Resolution
pub fn new() -> Resolution
Create a new empty resolution.
Sourcepub fn add_key_path(&mut self, path: Vec<&'static str>)
pub fn add_key_path(&mut self, path: Vec<&'static str>)
Add a key path (for depth-aware probing).
Sourcepub fn add_field(&mut self, info: FieldInfo) -> Result<(), DuplicateFieldError>
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.
Sourcepub fn add_variant_selection(
&mut self,
path: FieldPath,
enum_name: &'static str,
variant_name: &'static str,
)
pub fn add_variant_selection( &mut self, path: FieldPath, enum_name: &'static str, variant_name: &'static str, )
Add a variant selection to this resolution.
Sourcepub fn merge(&mut self, other: &Resolution) -> Result<(), DuplicateFieldError>
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.
Sourcepub fn mark_all_optional(&mut self)
pub fn mark_all_optional(&mut self)
Mark all fields as optional (required = false).
Used when a flattened field is wrapped in Option<T>.
Sourcepub fn matches(&self, input_fields: &BTreeSet<Cow<'_, str>>) -> MatchResult
pub fn matches(&self, input_fields: &BTreeSet<Cow<'_, str>>) -> MatchResult
Check if this resolution matches the input fields.
Sourcepub fn describe(&self) -> String
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.
Sourcepub fn deserialization_order(&self) -> Vec<&FieldInfo>
pub fn deserialization_order(&self) -> Vec<&FieldInfo>
Get the fields in deserialization order (deepest first).
Sourcepub fn required_field_names(&self) -> &BTreeSet<&'static str>
pub fn required_field_names(&self) -> &BTreeSet<&'static str>
Get the set of required field names.
Sourcepub fn missing_optional_fields<'a>(
&'a self,
seen_keys: &'a BTreeSet<Cow<'_, str>>,
) -> impl Iterator<Item = &'a FieldInfo>
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.
Sourcepub fn variant_selections(&self) -> &[VariantSelection]
pub fn variant_selections(&self) -> &[VariantSelection]
Get variant selections.
Sourcepub fn child_fields(&self) -> impl Iterator<Item = &FieldInfo>
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.
Sourcepub fn property_fields(&self) -> impl Iterator<Item = &FieldInfo>
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.
Sourcepub fn known_paths(&self) -> &BTreeSet<Vec<&'static str>>
pub fn known_paths(&self) -> &BTreeSet<Vec<&'static str>>
Get all known key paths (for depth-aware probing).
Sourcepub fn has_key_path(&self, path: &[&str]) -> bool
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
impl Clone for Resolution
Source§fn clone(&self) -> Resolution
fn clone(&self) -> Resolution
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more