pub struct FixedType { /* private fields */ }Expand description
A fixed-width scalar type, named without a value: what an absent value of that type stands in for.
AES-GCM keeps the plaintext’s length, so a plain null leaf (one byte)
sealed in place of a date (five) shows which values are absent to
anyone who can see the ciphertexts. A null of a FixedType is sealed as
a typed null padded to the type’s own leaf length, so a sealed
None and a sealed Some are the same length. See
Sink::typed_null and
tags::TYPED_NULL.
A FixedType is normalised to how its leaf is written, so two are equal
exactly when their typed nulls are the same bytes. A logical type with a
tag of its own fixes its width: a date is written as an i32 day count
and a nanosecond timestamp and a decimal as 128-bit words, whatever
width the value came with. A decimal’s scale travels inside its payload
rather than in its tag, so every decimal has the one typed null, of
scale 0.
Implementations§
Source§impl FixedType
impl FixedType
Sourcepub const fn plain(width: Width) -> Option<Self>
pub const fn plain(width: Width) -> Option<Self>
A plain int or float, with no logical type, or None for
Width::Bytes16: plain bytes are variable width.
Sourcepub const fn new(ty: Option<Logical>, width: Width) -> Option<Self>
pub const fn new(ty: Option<Logical>, width: Width) -> Option<Self>
ty over width, normalised, or None if the pair has no fixed
width: undefined (over null), a date, timestamp or decimal over a
float, a uuid over anything but sixteen bytes, and sixteen bytes
under anything but a uuid (plain or unknown bytes are variable
width, so a reader could not tell where their typed null ends).