Skip to main content

PayloadHeader

Struct PayloadHeader 

Source
pub struct PayloadHeader {
Show 24 fields pub arcs_off: u32, pub rings_off: u32, pub grid_off: u32, pub release_off: u32, pub eager_coords: u32, pub eager_rings: u32, pub eager_polys: u32, pub n_arcs: u32, pub raw_len: u32, pub grid_deg: f32, pub epsilon_m: f32, pub n_features: u16, pub ncols: u16, pub nrows: u16, pub uniq: u16, pub release_len: u16, pub flags: u16, pub dataset: Dataset, pub quant_bits: QuantBits, pub simplify_algorithm: SimplifyAlgorithm, pub geom: GeomEncoding, pub codec: Codec, pub density_weight_floor_e4: u16, pub reserved: u8,
}
Expand description

The container’s one fixed header record, which carries everything the reader needs to locate every section. It sits in PLAINTEXT right after the outer header (only the section blob after it is compressed), so any container is inspectable and validated before decompression. The encoder Pwrites it, the reader Preads it (both little-endian); field order is the wire order; all offsets are relative to the section blob that follows.

The section blob is laid out as the zone-string offsets and pool, the geometry-dependent sections at the stored offsets, the grid tables, and the TZBB release string at release_off.

Fields§

§arcs_off: u32

The offset of the arc store (geom 0/1) or of the FullRings coordinates (geom 2, 4-aligned).

§rings_off: u32

The offset of the poly→feature parent table (plus the ring records for geom 0/1).

§grid_off: u32

The offset of the grid tables, which hold the primary cells followed by the CSR list offsets and ids.

§release_off: u32

The offset of the TZBB release string (release_len bytes at the payload tail).

§eager_coords: u32

The eager-cache reservation counts, which give exact Vec sizes for preload() (the coords count is Σ referenced-arc vertex counts and may only over-estimate).

§eager_rings: u32§eager_polys: u32§n_arcs: u32

The arc count (geom 0/1), which is zero when there is no arc store.

§raw_len: u32

The section blob’s decompressed size (so readers allocate once).

§grid_deg: f32

The grid cell size in degrees; fractional sizes (e.g. 0.5) are allowed.

§epsilon_m: f32

The simplification tolerance the asset was built with (provenance).

§n_features: u16§ncols: u16

The grid’s column count.

§nrows: u16

The grid’s row count.

§uniq: u16

The number of distinct border-cell candidate lists (CSR).

§release_len: u16§flags: u16

This field is reserved and must be zero (room for future format flags).

§dataset: Dataset§quant_bits: QuantBits§simplify_algorithm: SimplifyAlgorithm§geom: GeomEncoding§codec: Codec

The section blob’s compression codec.

§density_weight_floor_e4: u16

The population-density weight floor in fixed-point 1e-4, where 0 means unweighted and 10000 means 1.0. Like epsilon_m, it is provenance for the density-weighted simplification knob.

§reserved: u8

This byte is reserved and must be zero (it pads the header to 64 bytes).

Implementations§

Source§

impl PayloadHeader

Source

pub fn from_asset(bytes: &[u8]) -> Option<PayloadHeader>

Parses the plaintext header out of a complete asset, checking the prologue first (magic + VERSION). The result is None if the bytes are too short, not a μTZ asset, or a different format version. The parse reads only the first PROLOGUE_LEN + PAYLOAD_HEADER_LEN bytes, which makes it cheap provenance sniffing without decompression.

Trait Implementations§

Source§

impl Clone for PayloadHeader

Source§

fn clone(&self) -> PayloadHeader

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PayloadHeader

Source§

impl Debug for PayloadHeader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&PayloadHeader> for Provenance

Source§

fn from(header: &PayloadHeader) -> Provenance

Converts to this type from the input type.
Source§

impl PartialEq for PayloadHeader

Source§

fn eq(&self, other: &PayloadHeader) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PayloadHeader

Source§

impl<'a> TryFromCtx<'a, Endian> for PayloadHeader
where PayloadHeader: 'a,

Source§

type Error = Error

Source§

fn try_from_ctx( src: &'a [u8], ctx: Endian, ) -> Result<(Self, usize), Self::Error>

Source§

impl<'a_fresh> TryIntoCtx<Endian> for &'a_fresh PayloadHeader

Source§

type Error = Error

Source§

fn try_into_ctx(self, dst: &mut [u8], ctx: Endian) -> Result<usize, Self::Error>

Source§

impl TryIntoCtx<Endian> for PayloadHeader

Source§

type Error = Error

Source§

fn try_into_ctx(self, dst: &mut [u8], ctx: Endian) -> Result<usize, Self::Error>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.