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 utils;
27
28pub use convert::{geojson, mvt};
29pub use decoder::{
30    ColNames, ColumnRef, Decoder, Extent, FeatureRef, GeometryType, GeometryValues, Layer, Layer01,
31    Layer01FeatureIter, LendingIterator, ParsedLayer, ParsedLayer01, Parser, PropKind, PropName,
32    PropNamesIter, PropValue, PropValueRef, PropertyKey, TileFeature, TileFeatureBuilder,
33    TileLayer, TileLayerBuilder, 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(crate) use utils::analyze::{Analyze, StatType};
44pub(crate) use utils::lazy_state::{Decode, DecodeState, Lazy, LazyParsed, Parsed};
45
46/// Wire-level encoding metadata - for tile analysis and tooling.
47///
48/// These types describe the physical and logical encoding of streams inside an
49/// MLT tile. Normal tile consumers (parse -> iterate features) do not need this
50/// module; it is intended for tools that inspect or report encoding statistics.
51pub mod wire {
52    pub use crate::decoder::ColumnType;
53    pub use crate::decoder::stream::model::{
54        DictionaryType, IntEncoding, LengthType, LogicalEncoding, LogicalTechnique, Morton,
55        OffsetType, PhysicalEncoding, RleMeta, StreamMeta, StreamType,
56    };
57    pub use crate::utils::analyze::{Analyze, StatType};
58}
59
60#[cfg(any(test, feature = "__private"))]
61pub use crate::utils::test_helpers;
62
63/// Private re-exports for benchmarks and integration tests. Not part of the public API.
64#[cfg(any(test, feature = "__private"))]
65#[doc(hidden)]
66pub mod __private {
67    pub use crate::codecs::*;
68    pub use crate::convert::*;
69    pub use crate::decoder::*;
70    pub use crate::errors::*;
71    pub use crate::test_helpers::*;
72    pub use crate::utils::analyze::*;
73    pub use crate::utils::lazy_state::*;
74    pub use crate::utils::*;
75}