2 个版本
0.0.2 | 2020年3月13日 |
---|---|
0.0.1 | 2020年3月13日 |
#2235 在 数据结构
20KB
380 行
tag-vec
用于标签向量的Rust包
示例
// Create a vector of tags with the tags
// "healthy"(healthy food), "junk"(junk food) and "veg"(vegetarian)
let foods: TagVec<String> = TagVec::new();
foods.push(vec!["healthy", "veg"]);
foods.push(vec!["junk"]);
foods.push(vec!["healthy", "veg"]);
foods.push(vec!["junk", "veg"]);
foods.push(vec!["junk"]);
// We don't want healthy or vegetarian food,
// we're not plebs who care about the planet, are we!?
use expressions::*;
let mut cool_foods = tags.query(and(not(tag("veg")), not(tag("healthy"))));
for food in cool_foods {
println!("{:?}", food);
}
// Expected output: (It only outputs the indices of the matching elements,
// this is a vec, so the order matters)
// 1
// 3
即将推出的功能
- 更改元素的标签
- 移除元素(啊,这将是一个昂贵的操作)
- 弹出元素(完全不昂贵!)