17 releases

✓ Uses Rust 2018 edition

0.2.0 Dec 22, 2019
0.1.15 Jul 11, 2019
0.1.14 Jun 2, 2019
0.1.12 Feb 25, 2019
0.1.9 Nov 5, 2018

#125 in Data structures

Download history 16/week @ 2019-10-06 48/week @ 2019-10-13 18/week @ 2019-10-20 33/week @ 2019-10-27 32/week @ 2019-11-03 2/week @ 2019-11-10 33/week @ 2019-11-17 17/week @ 2019-11-24 32/week @ 2019-12-01 196/week @ 2019-12-08 28/week @ 2019-12-22 1/week @ 2019-12-29 4/week @ 2020-01-05 171/week @ 2020-01-12

157 downloads per month

MIT license

31KB
296 lines

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', '.']
            ));
}

No runtime deps