Skip to main content

mlt_core/
lib.rs

1#![doc = include_str!("../README.md")]
2extern crate core;
3
4/// Validates stream metadata in constructors (crate-internal).
5macro_rules! validate_stream {
6    ($stream:expr, $expected:pat $(,)?) => {
7        if !matches!($stream.meta.stream_type, $expected) {
8            return Err($crate::MltError::UnexpectedStreamType2(
9                $stream.meta.stream_type,
10                stringify!($expected),
11                stringify!($stream),
12            ));
13        }
14    };
15}
16
17pub use fast_mvt;
18pub use geo_types;
19
20pub(crate) mod codecs;
21pub(crate) mod convert;
22pub(crate) mod decoder;
23pub mod dump;
24pub mod encoder;
25pub(crate) mod errors;
26pub(crate) mod tile;
27pub(crate) mod utils;
28
29pub use convert::{geojson, mvt};
30pub use decoder::{
31    ColNames, ColumnRef, Decoder, FeatureRef, GeometryType, GeometryValues, Layer, Layer01,
32    Layer01FeatureIter, LendingIterator, ParsedLayer, ParsedLayer01, Parser, PropName,
33    PropNamesIter, PropValueRef, Unknown,
34};
35// Crate-internal re-exports: allow internal modules to use `crate::Lazy` etc.
36// without exposing these implementation details to external users.
37pub(crate) use decoder::{
38    ColumnType, DictRange, DictionaryType, LengthType, OffsetType, RawPresence, RawSharedDict,
39    RawSharedDictItem, StreamType,
40};
41pub(crate) use errors::MltRefResult;
42pub use errors::{MltError, MltResult};
43pub use tile::{
44    Extent, PropKind, PropValue, PropertyKey, TileFeature, TileFeatureBuilder, TileLayer,
45    TileLayerBuilder,
46};
47pub(crate) use utils::analyze::{Analyze, StatType};
48pub(crate) use utils::lazy_state::{Decode, DecodeState, Lazy, LazyParsed, Parsed};
49
50/// Wire-level encoding metadata - for tile analysis and tooling.
51///
52/// These types describe the physical and logical encoding of streams inside an
53/// MLT tile. Normal tile consumers (parse -> iterate features) do not need this
54/// module; it is intended for tools that inspect or report encoding statistics.
55pub mod wire {
56    pub use crate::decoder::ColumnType;
57    pub use crate::decoder::stream::model::{
58        DictionaryType, IntEncoding, LengthType, LogicalEncoding, LogicalTechnique, Morton,
59        OffsetType, PhysicalEncoding, RleLayout, RleMeta, StreamMeta, StreamType,
60    };
61    pub use crate::utils::analyze::{Analyze, StatType};
62}
63
64#[cfg(any(test, feature = "__private"))]
65pub use crate::utils::test_helpers;
66
67/// Private re-exports for benchmarks and integration tests. Not part of the public API.
68#[cfg(any(test, feature = "__private"))]
69#[doc(hidden)]
70pub mod __private {
71    pub use crate::codecs::*;
72    pub use crate::convert::*;
73    pub use crate::decoder::*;
74    pub use crate::errors::*;
75    pub use crate::test_helpers::*;
76    pub use crate::tile::*;
77    pub use crate::utils::analyze::*;
78    pub use crate::utils::lazy_state::*;
79    pub use crate::utils::*;
80}