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
//! A Vietnamese typing composition engine.
//!
//! VI implement support for Vietnamese text composition using the two most common methods: Telex and VNI.
//! The two main methods of this library is `telex::transform_buffer` and `vni::transform_buffer` but
//! a range of useful utility methods and constants for Vietnamese text manipulation are also exposed.
//!
//! # Aspirations
//!
//! - Minimal to zero configuration. The engine should have a default configurations that fit with most usecases.
//! - Support all transformation behaviours & orders. Adding a tonemark during or after typing a word should just work.
//! - Be as fast as possible.
//! - Be as simple as possible.
//!
//! # Example
//!
//! ```
//! use vi::vni;
//! fn main() {
//! let inputs = vec![vec!['v', 'i', 'e', 't', '5', '6'], vec!['n', 'a', 'm']];
//! let mut result = String::new();
//! for input in inputs {
//! vni::transform_buffer(input.iter().cloned(), &mut result);
//! result.push(' ');
//! }
//! println!("{}", result); // prints "việt nam "
//! }
//! ```
//!
//! # Rules
//!
//! VI aims to be as lean as possible, focusing on only the useful features and main use-cases. Therefore, the engine
//! implemented these rules by default with no way of configuring them:
//!
//! - **Tone mark are placed in the new accent:** hoà instead of hòa
//! - **`w` in telex will insert `ư`:** so `chuw` or `chw` will produce `chư`
pub mod maps;
pub mod parsing;
pub mod processor;
pub mod telex;
pub mod util;
pub mod validation;
pub mod vni;
/// A result of a buffer transformation.
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct TransformResult {
/// Indicates whether a tone mark has been removed during the transformation.
tone_mark_removed: bool,
/// Indicates whether a letter modification has been removed during the transformation.
letter_modification_removed: bool,
}