Skip to main content

haystack_core/kinds/
mod.rs

1//! Haystack type system — the [`Kind`] enum and its 15 scalar types.
2//!
3//! Every value in the Haystack data model is represented as a [`Kind`] variant:
4//!
5//! | Variant | Rust Type | Zinc Example |
6//! |---------|-----------|--------------|
7//! | `Marker` | [`Marker`] | `M` |
8//! | `NA` | [`NA`] | `NA` |
9//! | `Remove` | [`Remove`] | `R` |
10//! | `Bool(bool)` | `bool` | `T` / `F` |
11//! | `Number(Number)` | [`Number`] | `72°F`, `100kW` |
12//! | `Str(String)` | `String` | `"hello"` |
13//! | `Ref(HRef)` | [`HRef`] | `@site-1 "Main Site"` |
14//! | `Uri(Uri)` | [`Uri`] | `` `http://example.com` `` |
15//! | `Date(NaiveDate)` | `chrono::NaiveDate` | `2024-01-15` |
16//! | `Time(NaiveTime)` | `chrono::NaiveTime` | `13:30:00` |
17//! | `DateTime(HDateTime)` | [`HDateTime`] | `2024-01-15T13:30:00-05:00 New_York` |
18//! | `Coord(Coord)` | [`Coord`] | `C(37.55,-77.45)` |
19//! | `Symbol(Symbol)` | [`Symbol`] | `^hot-water` |
20//! | `XStr(XStr)` | [`XStr`] | `Type("value")` |
21//! | `List(HList)` | [`HList`](crate::data::HList) | `[1, 2, 3]` |
22//! | `Dict(Box<HDict>)` | [`HDict`](crate::data::HDict) | `{dis:"Room" area:100}` |
23//! | `Grid(Box<HGrid>)` | [`HGrid`](crate::data::HGrid) | Nested grid |
24//!
25//! The [`units`] submodule provides a database of standard Haystack units with
26//! lookup by name ([`unit_for`]) or symbol ([`units_by_symbol`]).
27
28mod singletons;
29pub use singletons::{Marker, NA, Remove};
30
31mod number;
32pub use number::Number;
33
34mod ref_;
35pub use ref_::HRef;
36
37mod coord;
38pub use coord::Coord;
39
40mod uri;
41pub use uri::Uri;
42
43mod symbol;
44pub use symbol::Symbol;
45
46mod xstr;
47pub use xstr::XStr;
48
49mod datetime;
50pub use datetime::HDateTime;
51
52mod kind;
53pub use kind::Kind;
54
55mod units;
56pub use units::{Unit, unit_for, units_by_name, units_by_symbol};
57
58mod tz;
59pub use tz::{tz_for, tz_map};