Skip to main content

payload_from_topology

Function payload_from_topology 

Source
pub fn payload_from_topology(
    topology: &Topology,
    arc_coords: &[Arc],
    feats: &[Feat],
    params: &Params<'_>,
) -> Result<(Vec<u8>, PayloadStats)>
Expand description

Serializes an already-simplified topology: quantize → grid → sections. arc_coords may differ from topology.arc_coords (the wasm viewer simplifies per-arc itself); feats supplies only per-feature metadata (tzid, offset). Geometry comes from the arcs. params.epsilon_m is recorded in the header, not applied.

§Errors

The call errors on out-of-range params (quant_bits not 16/24/32, grid_deg outside 0.1–45, tzbb_release ≥ 256 bytes) or format-limit overflows (feature/polygon counts past 15-bit zone ids, CSR list tables past their 15-bit/u16 space, eager coordinate count past u32).

§Panics

Panics if a serialized section outgrows its u16/u32 format width where no Error::FormatLimit guard applies (a payload over 4 GiB, unreachable for real datasets).