Crate onigiri

Source
Expand description

onigiri::Onigiri is Factory. It can select either Vvc or Btmvc and generate it.

Vvc is Vec<Vec<char>>.

Btmvc is BTreeMap<usize, Vec<char>>.

onigiri::utils is the utilities of handling chars.

onigiri::validator is validate whether Vec<char> is valid.

Some examples are as follows.

use onigiri::Onigiri;
use onigiri::utils::cast;
use onigiri::validator;

let test_text = "(13 + 2)".to_string();
let oni = Onigiri::new(&test_text);
let vvc = oni.create_vvc(' ');
 
assert_eq!(
    &vvc.attr,
    &vec![vec!['(', '1','3'],vec!['+'],vec!['2', ')']]
);

let thirteen = &vvc.attr[0][1..].to_vec();
assert_eq!(validator::is_positive_integer(&thirteen), true);

let num = cast::<u8>(&thirteen);
assert_eq!(&num, &Some(13_u8));
assert_eq!(&num.unwrap() + 2, 15_u8);

Modules§

  • onigiri::utils contains some utilities of handling chars.
  • onigiri::validator contains some functions for validating Vec<char>.

Structs§