Skip to main content

Module kinds

Module kinds 

Source
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:

VariantRust TypeZinc Example
MarkerMarkerM
NANANA
RemoveRemoveR
Bool(bool)boolT / F
Number(Number)Number72°F, 100kW
Str(String)String"hello"
Ref(HRef)HRef@site-1 "Main Site"
Uri(Uri)Uri`http://example.com`
Date(NaiveDate)chrono::NaiveDate2024-01-15
Time(NaiveTime)chrono::NaiveTime13:30:00
DateTime(HDateTime)HDateTime2024-01-15T13:30:00-05:00 New_York
Coord(Coord)CoordC(37.55,-77.45)
Symbol(Symbol)Symbol^hot-water
XStr(XStr)XStrType("value")
List(HList)HList[1, 2, 3]
Dict(Box<HDict>)HDict{dis:"Room" area:100}
Grid(Box<HGrid>)HGridNested 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.
HDateTime
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.