pub enum Ty {
Show 16 variants
Bool,
Integer,
Decimal,
Text {
max_bytes: u64,
},
Enum(Vec<String>),
Timestamp,
Duration,
Maybe(Box<Ty>),
List {
item: Box<Ty>,
max: u64,
},
Record(Vec<(String, Ty)>),
Filtered {
max: u64,
id_bytes: u64,
},
Shortlist {
max: u64,
id_bytes: u64,
},
Ranking {
max: u64,
},
Nullable(Box<Ty>),
Map {
key_max: u64,
value: Box<Ty>,
max: u64,
},
Joined {
value: Box<Ty>,
max: u64,
id_bytes: u64,
},
}Expand description
The static type of an exact value.
Variants§
Bool
Integer
Decimal
Text
Enum(Vec<String>)
Timestamp
Duration
Maybe(Box<Ty>)
An operator result that may be empty, such as extremum@1 over no
items or a timestamp_diff@1 of one; distinct from Ty::Nullable,
a declared version 2 record field.
List
Record(Vec<(String, Ty)>)
Filtered
A filter result: at most max eligible ids of at most id_bytes.
Shortlist
Ranking
Nullable(Box<Ty>)
Version 2, record fields only: the field’s type, or null (spec 032,
3.4.1). Reading the field yields the inner type; a null read is
missing_evidence.
Map
Version 2: text keys of at most key_max bytes, at most max
entries.
Joined
A join_keyed@1 result: one entry per left item, in left order
(spec 032, 3.5.2). Per-item operators see a matched entry as the
record {id, match}.
Implementations§
Source§impl Ty
impl Ty
pub fn from_decl(d: &TypeDecl) -> Ty
Sourcepub fn same_shape(&self, other: &Ty) -> bool
pub fn same_shape(&self, other: &Ty) -> bool
Same kind of value, ignoring size bounds and enum option sets beyond both being enums. Used for comparison operands.
Sourcepub fn join_item(value: &Ty, id_bytes: u64) -> Ty
pub fn join_item(value: &Ty, id_bytes: u64) -> Ty
The record a per-item operator sees for one joined entry.
Sourcepub fn max_json_bytes(&self) -> u64
pub fn max_json_bytes(&self) -> u64
An upper bound on the canonical JSON bytes of a value of this type: strings count six bytes per content byte (worst-case escaping).