pub enum Scalar {
Null,
Bool(bool),
Int(BigInt),
Float(f64),
Str(String),
Date(String),
Time(String),
Datetime(String),
}Expand description
A leaf value.
Int is arbitrary-precision (BigInt), not a fixed-width integer –
omnist-spec §2.2 defines integer as arbitrary-precision, bounded only
by the shared digit-count cap (MAX_INT_DIGITS), the same way Python’s
native int and Go’s *big.Int already are (issue #104; previously
i64, which silently rejected any literal past ~19 digits – a
spec-conformance bug, not a permitted narrower-limit variation, since no
digit-count override was in play).
Date/Time/Datetime (issue #105) each hold their already
shape-validated, canonical ISO spelling – no chrono/time crate
dependency, since the algebra never does temporal arithmetic, only
equality and canonical rendering (the same reasoning issue #104 applied
to Int). Constructing one always goes through
crate::schema::is_iso_date/is_iso_time/is_iso_datetime (shape
validation) and, for Time/Datetime,
crate::schema::canonicalize_iso_time/canonicalize_iso_datetime
(canonicalization) – there is no code path that constructs one of
these holding un-validated or non-canonical text. This closed the
architecture gap issue #16 originally left open (previously cited as a
reason Scalar had no temporal variant at all); see issue #99’s
RawNode::TemporalLeaf, now removed, for the write-hint mechanism this
replaces.
Variants§
Null
Null scalar value (spec §2.2).
Bool(bool)
Boolean scalar value (spec §2.2).
Int(BigInt)
Arbitrary-precision integer scalar value (spec §2.2).
Float(f64)
IEEE 754 floating point scalar value (spec §2.2).
Str(String)
UTF-8 string scalar value (spec §2.2).
Date(String)
ISO 8601 calendar date (YYYY-MM-DD, spec §2.2).
Time(String)
ISO 8601 clock time (hh:mm:ss, spec §2.2).
Datetime(String)
ISO 8601 date-time (YYYY-MM-DDThh:mm:ss, spec §2.2).