Expand description
Haystack type system — the Kind enum and its 15 scalar types.
Every value in the Haystack data model is represented as a Kind variant:
| Variant | Rust Type | Zinc Example |
|---|---|---|
Marker | Marker | M |
NA | NA | NA |
Remove | Remove | R |
Bool(bool) | bool | T / F |
Number(Number) | Number | 72°F, 100kW |
Str(String) | String | "hello" |
Ref(HRef) | HRef | @site-1 "Main Site" |
Uri(Uri) | Uri | `http://example.com` |
Date(NaiveDate) | chrono::NaiveDate | 2024-01-15 |
Time(NaiveTime) | chrono::NaiveTime | 13:30:00 |
DateTime(HDateTime) | HDateTime | 2024-01-15T13:30:00-05:00 New_York |
Coord(Coord) | Coord | C(37.55,-77.45) |
Symbol(Symbol) | Symbol | ^hot-water |
XStr(XStr) | XStr | Type("value") |
List(HList) | HList | [1, 2, 3] |
Dict(Box<HDict>) | HDict | {dis:"Room" area:100} |
Grid(Box<HGrid>) | HGrid | Nested grid |
The [units] submodule provides a database of standard Haystack units with
lookup by name (unit_for) or symbol (units_by_symbol).
Structs§
- Coord
- A geographic coordinate represented as latitude and longitude in decimal degrees.
- HDate
Time - Timezone-aware datetime with Haystack city-based timezone name.
- HRef
- Haystack Ref — an entity reference.
- Marker
- Marker tag — boolean presence indicator.
In Zinc:
M. In JSON:{"_kind": "marker"}. - NA
- Not Available — missing or invalid data sentinel.
In Zinc:
NA. In JSON:{"_kind": "na"}. - Number
- Haystack Number — a 64-bit float with optional unit string.
- Remove
- Remove — tag removal in diff/update operations.
In Zinc:
R. In JSON:{"_kind": "remove"}. - Symbol
- Reference to a def/tag definition name.
Zinc:
^hot-water - Unit
- A Haystack unit definition.
- Uri
- A Haystack URI value wrapping an arbitrary string.
- XStr
- Extended typed string — vendor-specific scalar.
Zinc:
Color("red")
Enums§
- Kind
- The central Haystack value type. Every tag value is a Kind.
Functions§
- tz_for
- Resolve a Haystack timezone name to an IANA identifier.
- tz_map
- Get the full timezone map.
- unit_
for - Look up a unit by name or symbol.
- units_
by_ name - Get all units indexed by name.
- units_
by_ symbol - Get all units indexed by symbol.