pub enum SynthType {
Null,
Boolean,
Integer,
Float,
Text(Option<String>),
Array(Box<SynthType>),
Tuple(Vec<SynthType>),
Record(SynthRecord),
Union(SynthUnion),
Any,
Never,
Hole(Option<Identifier>),
}Expand description
A synthesized type inferred from document values.
Unlike SchemaNodeContent, this type does not include validation
constraints (min/max length, patterns, etc.) - it represents only
the structural type of the data.
Variants§
Null
Null value
Boolean
Boolean value
Integer
Integer value (arbitrary precision)
Float
Floating-point value
Text(Option<String>)
Text value with optional language tag
None- implicit/unknown language (from`...`)Some("plaintext")- plaintext (from"...")Some("rust")- language-tagged (fromrust`...`)
Array(Box<SynthType>)
Homogeneous array type
Tuple(Vec<SynthType>)
Tuple type (fixed-length, heterogeneous)
Record(SynthRecord)
Record type (fixed named fields)
Union(SynthUnion)
Union of types (structural, not tagged)
Invariants:
- At least 2 variants
- No nested unions (flattened)
- No duplicate variants
Any
Top type - accepts any value
Used for:
- Empty arrays:
[]has typeArray<Any> - Unknown types
Never
Bottom type - no values
Used for contradictions (rare in practice)
Hole(Option<Identifier>)
Unfilled placeholder
Holes are absorbed during unification:
unify(Integer, Hole) = Integer
Implementations§
Source§impl SynthType
impl SynthType
Sourcepub fn is_primitive(&self) -> bool
pub fn is_primitive(&self) -> bool
Check if this is a primitive type
Sourcepub fn is_compound(&self) -> bool
pub fn is_compound(&self) -> bool
Check if this is a compound type
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if this type is complete (no holes, no Any, no Never)