Skip to main content

Module config

Module config 

Source
Expand description

The consumer-facing builder API for the custom tier, where the typed config IS the build config (rustdoc’d, IDE-completable, with no file discovery). It is meant for a consumer build.rs with utz_build as a build-dependency (the prost-build pattern):

// build.rs
let out = utz_build::Config::new()
    .dataset(utz_build::Dataset::Now)
    .epsilon_meters(500.0)
    .generate()
    .unwrap();
// then in the crate:
//   static TZ: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/tz.utz"));
//   let finder = utz::Finder::from_slice(TZ)?;

Source data (TZBB, optionally GHS-POP for density weighting) is fetched into the cache, never committed; downloads are conditional-GET-cached so regeneration is cheap.

The preset recipes double as constructors. Start from one and override a single knob instead of spelling the whole recipe: Config::compact().codec(Codec::Uncompressed). The recipe values themselves live in one place, the utz_common::presets table; the constructors here are thin wrappers over the From<&Recipe> conversion.

Structs§

Config
The builder for a custom .utz asset. The defaults are dataset now, RDP ε=500 m, no density weighting, i24, a 2° grid, gzip, varint-arcs geometry, and output to $OUT_DIR/tz.utz.

Functions§

write_guard
Emits <asset>.guard.rs, the const _ assertions against utz::caps for the geometry decoder and codec the asset needs (shared by Config::generate() and the gen CLI).