Expand description
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")),
_ => {},
}
}
}
Structsยง
- Queue
- A queue which can be modified while being iterated through.