Macro rb_tree::new_c_queue [−][src]
macro_rules! new_c_queue { ($cmp:expr) => { ... }; ($cmp:expr; $($v:expr),*) => { ... }; }
Expand description
Allows the creation of a queue using C-like
comparison values. That is to say, cmp
should return a value less than, equal to,
or greater than 0 when l
should be placed
before, is equal to, or be placed after r
respectively.
cmp
should be a function that takes two values
from the queue and returns an integer (i8)
providing the information as above.
Example:
let mut q = new_c_queue!(|l: &i64, r| (r - l)); q.insert(1); q.insert(2); q.insert(3); assert_eq!(q.ordered(), [&3, &2, &1]);
Example:
let q = new_c_queue!(|l: &i64, r| (r - l); 1, 2, 3); assert_eq!(q.ordered(), [&3, &2, &1]);