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