deencode/
lib.rs

1pub mod deencodetree;
2pub mod engine;
3pub mod latin1engine;
4pub mod mixed816beengine;
5pub mod mixed816leengine;
6pub mod utf7engine;
7pub mod utf8engine;
8
9pub use engine::Engine;
10pub use deencodetree::DeencodeTree;
11
12/// Provided engine for Latin-1 / ISO-8859-1 / Codepage 1252.
13pub static LATIN1: latin1engine::Latin1Engine = latin1engine::Latin1Engine {};
14/// Provided engine for a mixed UTF-8/UTF-16BE scheme.
15pub static MIXED816BE: mixed816beengine::Mixed816BEEngine =
16    mixed816beengine::Mixed816BEEngine {};
17/// Provided engine for a mixed UTF-8/UTF-16LE scheme.
18pub static MIXED816LE: mixed816leengine::Mixed816LEEngine =
19    mixed816leengine::Mixed816LEEngine {};
20/// Provided engine for UTF-7.
21pub static UTF7: utf7engine::Utf7Engine = utf7engine::Utf7Engine {};
22/// Provided engine for UTF-8.
23pub static UTF8: utf8engine::Utf8Engine = utf8engine::Utf8Engine {};
24
25/// Build a [`DeencodeTree`] by successively running encodings and decodings
26/// through the engines.
27///
28/// Alias of [`DeencodeTree::deencode()`].
29///
30/// `encoding_depth` specifies the number of _encoding_ steps, which are always
31/// followed by a decoding step, so the actual depth of the generated tree is
32/// `2 * encoding_depth`.
33///
34/// The process starts with encoding, so you may not have `depth == 0`. (see
35/// [`EncodeNode::make_nodes()`](deencodetree::EncodeNode::make_nodes)'s
36/// documentation)
37///
38/// The order of the engines matters for [`DeencodeTree::deduplicate()`].
39pub fn deencode(input: &str, engines: &[&dyn Engine], encoding_depth: usize)
40    -> DeencodeTree
41{
42    DeencodeTree::deencode(input, engines, encoding_depth)
43}