std-method
BTreeMap::pop_first
Remove and own the earliest record by key. A schedule keyed by deadline can use it to process work in ascending order. Expected stdout (not executed): Some((6, "pack")) 1 Common mistake: Expecting FIFO arrival order.
Formal Syntax & Structure
rust syntaxrust
fn pop_first(&mut self) -> Option<(K, V)>Working Example
Example Snippetrust
fn main() { use std::collections::BTreeMap; let mut jobs = BTreeMap::from([(18, "ship"), (6, "pack")]); println!("{:?}", jobs.pop_first()); println!("{}", jobs.len());}