Skip to main content

stt_core/
lib.rs

1//! Core library for the **SpatioTemporal Tiles (STT)** format.
2//!
3//! The canonical container is the **packed format** ([`pack`]): a per-dataset
4//! `manifest.json` plus many content-addressed, immutable pack objects
5//! (`packs/<blake3>.sttp`) and one directory object (`index/<blake3>.sttd`).
6//! Splitting a dataset into small, immutable objects is what makes it
7//! edge-cacheable on a plain CDN — see `docs/spec/stt-packed-format.md`.
8//!
9//! Building blocks:
10//! - [`pack`] — the packed format: [`PackWriter`], [`PackedReader`], [`Manifest`],
11//!   [`verify_packed_objects`].
12//! - [`arrow_tile`] — Arrow-IPC tile payloads with GeoArrow geometry.
13//! - [`directory`] — the run-length tile directory (v5) and its [`TileEntry`].
14//! - [`curve`] — spatial (Hilbert) + temporal blob ordering.
15//! - [`metadata`] — dataset metadata (folded verbatim into the manifest).
16//! - [`compression`] — per-blob zstd.
17
18pub mod arrow_tile;
19pub mod budget;
20pub mod compression;
21pub mod curve;
22pub mod directory;
23pub mod directory_page;
24pub mod error;
25pub mod geometry;
26pub mod metadata;
27pub mod pack;
28pub mod projection;
29pub mod tile;
30pub mod timestamp;
31pub mod types;
32
33// Re-export commonly used types.
34// Packed format — the canonical container.
35pub use pack::{verify_packed_objects, Manifest, PackWriter, PackedReader};
36pub use directory::TileEntry;
37pub use directory_page::{
38    decode_paged_directory, encode_paged_directory, verify_paged_structure, PageDescriptor,
39    PagedRoot, DEFAULT_PAGE_ENTRIES,
40};
41pub use curve::BlobOrdering;
42pub use error::{Error, Result};
43pub use tile::TileId;
44pub use timestamp::{
45    normalize_timestamp_to_ms, reject_negative_timestamp, scale_timestamp_to_ms, TimestampUnit,
46};
47pub use types::{BoundingBox, TimeRange};
48
49#[cfg(test)]
50mod tests {
51    use super::*;
52
53    #[test]
54    fn test_tile_id_ordering() {
55        let t1 = TileId::new(10, 512, 384, 1609459200000);
56        let t2 = TileId::new(10, 512, 384, 1609545600000);
57        assert!(t1 < t2);
58    }
59}