1 unstable release
Uses old Rust 2015
0.0.1 | May 15, 2018 |
---|
#41 in #iter
15KB
142 lines
Agenda
Safe collections that can be mutated while being iterated through
This crate helps to improve the readability and remove some friction from worklist-style algorithms that might push to a collection while iterating through it.
License
lib.rs
:
Convenient collection that allows safe mutation during iteration
Agenda
offers queue-like functionality but has interior mutability to
permit pushing and popping inside a for-loop.
use agenda::Queue;
fn iter(queue: Queue<String>) {
for item in queue.iter() {
match item.as_str() {
"three" => queue.push(String::from("two")),
"two" => queue.push(String::from("one")),
"one" => queue.push(String::from("zero")),
_ => {},
}
}
}