pub enum Value {
Number(f64),
Text(String),
Boolean(bool),
Error(String),
ErrorMsg(String, String),
Empty,
Array(Vec<Vec<Value>>),
Date(f64),
Zoned(Box<ZonedInstant>),
}Expand description
An evaluated cell value — one of the seven types of schema spec §6.
Wire encodings extend the published @truecalc/core npm shapes:
{ "type": "number", "value": 1.5 }, with error using an error key
({ "error": "#REF!", "type": "error" }).
Invariants (schema spec §6 and §8):
NumberandDateare always finite — NaN and infinity are unrepresentable; the serializer rejects them and the deserializer refuses them.-0.0is normalized to0.0on deserialization, and equality/hashing treat them as the same value.Arrayis row-major, rectangular, non-empty, larger than 1×1 (a 1×1 array is collapsed to its scalar element before storage, schema spec §6), and holds only scalar values (never a nestedArray). It appears only as a spill anchor’s value (schema spec §5).
Variants§
Number(f64)
Finite IEEE-754 f64.
Text(String)
Any Unicode string.
Boolean(bool)
A boolean.
Error(String)
A spreadsheet error code, e.g. #REF!. Allowed codes are the
engine’s error set for the workbook’s flavor (registry-driven).
ErrorMsg(String, String)
An error code carrying an additive diagnostic message (Google Sheets
parity, e.g. the arity message for DATE()). The message is in-memory
metadata only: it is not part of value identity (equality and
hashing compare by code — see the hand-written PartialEq/Hash) and
is dropped by canonical serialization, so the persisted JSON, the
to_json ∘ from_json = id guarantee, and hash/equality are all
byte-for-byte unchanged from a bare Error(code). Consumers read it via
Value::error_message.
Empty
An evaluated-empty result (a formula cell before first recalc, or a formula referencing an unauthored cell). Never used to pad the sparse grid.
Array(Vec<Vec<Value>>)
Row-major 2-D array of scalar values; a spill anchor’s full evaluated array.
Date(f64)
A date as a serial number (fractional part = time of day). The epoch is implied by the workbook’s engine flavor, never stored per-value.
Zoned(Box<ZonedInstant>)
A zone-aware instant (Model B). Serialized as its canonical, self-
describing RFC-9557 string, e.g. 2026-07-14T11:00:00+02:00[Europe/Berlin].
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl PartialEq for Value
Errors compare by code only — the diagnostic message is additive
metadata and must never affect identity (a message-carrying error stays
equal to the same bare error code, so canonical round-tripping and grid
deduplication are unchanged). Every non-error arm matches the previous
#[derive(PartialEq)] behaviour exactly.
impl PartialEq for Value
Errors compare by code only — the diagnostic message is additive
metadata and must never affect identity (a message-carrying error stays
equal to the same bare error code, so canonical round-tripping and grid
deduplication are unchanged). Every non-error arm matches the previous
#[derive(PartialEq)] behaviour exactly.