1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! Library-first parser for MDict `.mdx` and `.mdd` files.
//!
//! MDX and MDD share one defensive, file-backed parsing core. Opening parses
//! bounded metadata and block indexes; key and record blocks remain lazy.
//!
//! Physical ordinals preserve duplicate identity. By default, raw-exact lookup
//! wins before header-normalized fallback. MDX can opt into [`MatchMode`] to
//! include case variants after exact rows. MDD resources can be streamed through
//! source-bound spans. Per-open limits bound untrusted input and parser work.
//! MDX callers may optionally build a bounded, source-bound persistent key
//! index and reopen it through safe lazy positional reads; artifact placement
//! and publication remain caller-owned.
//! MDict wire checksum comparisons are controlled by [`ChecksumPolicy`] and
//! default to [`ChecksumPolicy::Skip`] for throughput; structural parsing and
//! decompression validation remain enabled.
//! Plaintext version 2 dictionaries can be created with [`MdxBuilder`] and
//! [`MddBuilder`], and existing MDX files can be rebuilt with an [`EditSet`]
//! applied through [`rebuild_mdx`]. Open version 2 files can also be decoded
//! and re-encoded wholesale through [`reencode_mdx`] and [`reencode_mdd`]:
//! every block is decoded and re-emitted with the same structure, so
//! uncompressed sources come back byte-identical and zlib sources differ
//! only inside compressed streams.
//!
//! # Wire versions
//!
//! MDict major versions 1 and 2 are both read through this API. The version is
//! resolved once, from the header, and selects one grammar; it never reaches
//! lookup, iteration, ordinal access, record decoding, or MDD streaming. A file
//! that fails one grammar is never retried under the other.
//!
//! Version 1 support covers unencrypted files using uncompressed or LZO blocks.
//! Encrypted version 1 files and the ISO8859-1 text label are refused with a
//! precise error rather than parsed speculatively.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;