onigiri

Crates.ioonigiri
lib.rsonigiri
version0.2.0
sourcesrc
created_at2018-08-21 02:44:02.069701
updated_at2019-12-22 05:15:59.696906
descriptionThis crate is a tool of handling chars.
homepage
repositoryhttps://github.com/masahiko-ofgp/onigiri
max_upload_size
id80520
size52,797
masahiko_ofgp (masahiko-ofgp)

documentation

README

onigiri

Build Status

onigiri

onigiri is the tool of handling chars in Rust. The japanese name of rice ball is "Onigiri". In my image, a grain of rice is char. And what collected them is chars.

Dec 22, 2019

onigiri 0.2.0 released.

  • Add struct Onigiri. This is Factory. It can select either Vvc or Btmvc and generate it.
  • Remove tools.rs.
  • Add vvc.rs, btmvc.rs, 'utils.rs'.

Usage

You add onigiri in Cargo.toml.

[dependencies]
onigiri = "0.2.0"

example is as follows.

use onigiri::Onigiri;
use onigiri::vvc::Vvc;

fn main() {
    let s = "I eat an onigiri.".to_string();

    let oni = Onigiri::new(&s);

    // Create Vec<Vec<char>>
    let vvc = oni.create_vvc(' ');

    // Create BTreeMap<usize, Vec<char>>
    let btmvc = oni.create_btmvc(' ');

    assert_eq!(
        vvc,
        Vvc {
            attr: vec![
                vec!['I'],
                vec!['e', 'a', 't'],
                vec!['a', 'n'],
                vec!['o', 'n', 'i', 'g', 'i', 'r', 'i', '.']
            ]
        }
        );

    assert_eq!(btmvc.attr.get(&0), Some(&vec!['I']));
    assert_eq!(btmvc.attr.get(&1), Some(&vec!['e', 'a', 't']));
    assert_eq!(btmvc.attr.get(&2), Some(&vec!['a', 'n']));
    assert_eq!(btmvc.attr.get(&3), Some(
            &vec!['o', 'n', 'i', 'g', 'i', 'r', 'i', '.']
            ));
}
Commit count: 48

cargo fmt