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
17// re-export geo types
18pub use geo_types;
19
20pub(crate) mod codecs;
21pub(crate) mod convert;
22pub(crate) mod decoder;
23pub mod encoder;
24pub(crate) mod errors;
25pub(crate) mod utils;
26
27pub use convert::{geojson, mvt};
28pub use decoder::{
29    ColumnRef, Decoder, FeatureRef, GeometryType, GeometryValues, Layer, Layer01,
30    Layer01FeatureIter, LendingIterator, ParsedLayer, ParsedLayer01, Parser, PropName, PropValue,
31    PropValueRef, TileFeature, TileLayer, Unknown,
32};
33// Crate-internal re-exports: allow internal modules to use `crate::Lazy` etc.
34// without exposing these implementation details to external users.
35pub(crate) use decoder::{
36    ColumnType, DictRange, DictionaryType, LengthType, OffsetType, RawPresence, RawSharedDict,
37    RawSharedDictItem, StreamType,
38};
39pub(crate) use errors::MltRefResult;
40pub use errors::{MltError, MltResult};
41pub(crate) use utils::analyze::{Analyze, StatType};
42pub(crate) use utils::lazy_state::{Decode, DecodeState, Lazy, LazyParsed, Parsed};
43
44/// Wire-level encoding metadata — for tile analysis and tooling.
45///
46/// These types describe the physical and logical encoding of streams inside an
47/// MLT tile. Normal tile consumers (parse → iterate features) do not need this
48/// module; it is intended for tools that inspect or report encoding statistics.
49pub mod wire {
50    pub use crate::decoder::ColumnType;
51    pub use crate::decoder::stream::model::{
52        DictionaryType, IntEncoding, LengthType, LogicalEncoding, LogicalTechnique, Morton,
53        OffsetType, PhysicalEncoding, RleMeta, StreamMeta, StreamType,
54    };
55    pub use crate::utils::analyze::{Analyze, StatType};
56}
57
58#[cfg(any(test, feature = "__private"))]
59pub use crate::utils::test_helpers;
60
61/// Private re-exports for benchmarks and integration tests. Not part of the public API.
62#[cfg(any(test, feature = "__private"))]
63#[doc(hidden)]
64pub mod __private {
65    pub use crate::codecs::*;
66    pub use crate::convert::*;
67    pub use crate::decoder::*;
68    pub use crate::errors::*;
69    pub use crate::test_helpers::*;
70    pub use crate::utils::analyze::*;
71    pub use crate::utils::lazy_state::*;
72    pub use crate::utils::*;
73}