#[non_exhaustive]pub enum FieldType {
Null,
Bool,
Int,
Float,
Str,
Ref,
Extended(ExtKind),
Map,
Seq,
}Expand description
The field-type vocabulary a fields.<name>.type declaration is spelled in,
re-exported so a consumer can name types without depending on fig-schema
(or, for ExtKind, on fig) directly — and so neither can drift to a
different version than the one prov resolves against.
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.
Trait Implementations§
impl Copy for FieldType
impl Eq for FieldType
impl StructuralPartialEq for FieldType
Auto Trait Implementations§
impl Freeze for FieldType
impl RefUnwindSafe for FieldType
impl Send for FieldType
impl Sync for FieldType
impl Unpin for FieldType
impl UnsafeUnpin for FieldType
impl UnwindSafe for FieldType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.