#[non_exhaustive]pub enum FieldType {
Null,
Bool,
Int,
Float,
Str,
Ref,
Extended(ExtKind),
Map,
Seq,
}Expand description
The type a field expects. Drives type-directed parsing and widget choice.
#[non_exhaustive]: fig gains ExtKinds and a schema gains field shapes
in ordinary releases, so a match needs a _ arm. Constructing a variant
is unaffected.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Null
Bool
Int
Float
Str
Ref
A link into the workspace (stored textually, like Str, but a reference).
Extended(ExtKind)
A format-specific scalar carried verbatim — a TOML datetime, a ZON enum
or char literal. Coercing to one keeps the value’s native type instead
of quoting it into a string, so a TOML date = 1979-05-27 survives an
edit as a date rather than becoming date = "1979-05-27".
Map
Seq
Implementations§
Source§impl FieldType
impl FieldType
Sourcepub fn coerce(self, s: &str) -> Value
pub fn coerce(self, s: &str) -> Value
Coerce an edit-buffer string to this type — the schema-directed counterpart of shape-guessing. A value that doesn’t fit the type falls back to a string (the caller’s own reparse is the final backstop); container types are not scalar-edited, so they also pass through as text.
The numeric types go through Value::parse_number, so the text fig
itself writes reads back unchanged — including the .inf/.nan
spellings str::parse::<f64> rejects. Those still have no
representation in JSON or TOML, so an embedder targeting those formats
should reject them before they reach here.