Crates.io | tag-vec |
lib.rs | tag-vec |
version | 0.0.2 |
source | src |
created_at | 2020-03-13 20:16:26.613339 |
updated_at | 2020-03-13 20:48:01.960197 |
description | A vector used for storing tags |
homepage | |
repository | https://github.com/TrolledWoods/tag-vec |
max_upload_size | |
id | 218335 |
size | 20,821 |
A rust crate for a vector of tags
// 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