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.
Variants§
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.
Note that Float accepts the non-finite spellings Rust’s parser does
(inf, NaN). fig renders those as YAML’s .inf/.nan, but they have
no representation in JSON or TOML — an embedder targeting those formats
should reject them before they reach here.