Crates.io | onigiri |
lib.rs | onigiri |
version | 0.2.0 |
source | src |
created_at | 2018-08-21 02:44:02.069701 |
updated_at | 2019-12-22 05:15:59.696906 |
description | This crate is a tool of handling chars. |
homepage | |
repository | https://github.com/masahiko-ofgp/onigiri |
max_upload_size | |
id | 80520 |
size | 52,797 |
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
.
onigiri 0.2.0 released.
Onigiri
. This is Factory. It can select either Vvc
or
Btmvc
and generate it.tools.rs
.vvc.rs
, btmvc.rs
, 'utils.rs'.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', '.']
));
}