pub struct FieldItem {
pub field: Option<Field>,
pub name: Cow<'static, str>,
pub rename: Option<Cow<'static, str>>,
pub flattened: bool,
pub is_text_variant: bool,
}Expand description
A field item with runtime state for serialization.
This wraps a static Field with additional runtime state that can be modified
during iteration (e.g., for flattened enums where the field name becomes the variant name,
or for flattened maps where entries become synthetic fields).
Fields§
§field: Option<Field>The underlying static field definition (None for flattened map entries)
name: Cow<'static, str>Runtime-determined name (may differ from field.name for flattened enums/maps)
rename: Option<Cow<'static, str>>Result of applying any field-level #[facet(rename = ...)] or container-level
#[facet(rename_all = ...)] attributes. If None, no such attribute was encountered.
flattened: boolWhether this field was flattened from an enum (variant name used as key)
is_text_variant: boolWhether this is a text variant (html::text or xml::text) from a flattened enum. When true, the value should be serialized as raw text without an element wrapper.
Implementations§
Source§impl FieldItem
impl FieldItem
Sourcepub const fn new(field: Field) -> Self
pub const fn new(field: Field) -> Self
Create a new FieldItem from a Field, using the field’s name
Sourcepub fn flattened_enum(field: Field, variant: &Variant) -> Self
pub fn flattened_enum(field: Field, variant: &Variant) -> Self
Create a flattened enum field item with a custom name (the variant name)
Sourcepub const fn flattened_map_entry(key: String) -> Self
pub const fn flattened_map_entry(key: String) -> Self
Create a flattened map entry field item with a dynamic key
Sourcepub fn effective_name(&self) -> &str
pub fn effective_name(&self) -> &str
Returns the effective name for this field item, preferring the rename over the original name