pub mod compiler;
pub mod engine;
pub mod rule;
pub mod tables;
pub mod trie;
#[cfg(feature = "wasm")]
pub mod wasm;
pub use compiler::CompiledLayout;
pub use engine::LekhaniParser;
pub use rule::{ConditionScope, MatchType, Pattern, PatternRule, RuleCondition};
use std::sync::{Arc, OnceLock};
static DEFAULT_AVRO_LAYOUT: OnceLock<Arc<CompiledLayout>> = OnceLock::new();
const EMBEDDED_AVRO_JSON: &str = include_str!("../data/avrophonetic.json");
pub fn get_default_avro_layout() -> Arc<CompiledLayout> {
DEFAULT_AVRO_LAYOUT
.get_or_init(|| {
let json: serde_json::Value = serde_json::from_str(EMBEDDED_AVRO_JSON)
.expect("Corrupt embedded avrophonetic.json layout");
let layout = CompiledLayout::from_json(&json)
.expect("Failed to compile embedded avrophonetic.json");
Arc::new(layout)
})
.clone()
}
pub fn default_avro_parser() -> LekhaniParser {
LekhaniParser::new(get_default_avro_layout())
}