pub enum FieldKind {
Any,
Enum(Vec<String>),
EnumArray(Vec<String>),
Object(ObjectSchema),
ObjectArray(ObjectSchema),
Integer,
Number,
Bool,
String,
}Expand description
Expected shape of a single field value.
After a field’s name has been repaired, its FieldKind decides what
repair (if any) is applied to the field’s value:
- Fuzzy correction against a closed set (
FieldKind::Enum,FieldKind::EnumArray) - Recursive repair with a nested schema (
FieldKind::Object,FieldKind::ObjectArray) - Type coercion of string-encoded scalars (
FieldKind::Integer,FieldKind::Number,FieldKind::Bool,FieldKind::String)
Values that don’t match the expected shape (e.g. a non-parseable string
for FieldKind::Integer) are left untouched — no lossy repair is made.
Variants§
Any
No value repair; the value is left untouched.
Enum(Vec<String>)
A string constrained to a closed set of values; fuzzy-corrected.
EnumArray(Vec<String>)
An array of strings, each constrained to a closed set; fuzzy-corrected.
Object(ObjectSchema)
A nested object repaired recursively with its own schema.
ObjectArray(ObjectSchema)
An array of objects, each repaired recursively with the same schema.
Integer
Coerce string-encoded integers to numbers ("42" → 42).
Number
Coerce string-encoded numbers to numbers ("4.2" → 4.2).
Bool
Coerce string-encoded booleans to booleans ("true" → true).
String
Coerce scalar numbers / booleans to their string rendering (42 → "42").
Implementations§
Source§impl FieldKind
impl FieldKind
Sourcepub fn enum_of<I, S>(values: I) -> Self
pub fn enum_of<I, S>(values: I) -> Self
Build an FieldKind::Enum from any iterator of string-likes.
Sourcepub fn enum_array<I, S>(values: I) -> Self
pub fn enum_array<I, S>(values: I) -> Self
Build an FieldKind::EnumArray from any iterator of string-likes.