std.pqueue
arena binary heap; O(log n) push/pop; order = any type with less()
pub Min :: struct($T: type) { marker: u8,}smallest first
Min.less
Section titled “Min.less”pub less :: fn(self: *Self, a: T, b: T) -> boolpub Max :: struct($T: type) { marker: u8,}largest first
Max.less
Section titled “Max.less”pub less :: fn(self: *Self, a: T, b: T) -> boolpub By :: struct($T: type) { f: fn(T, T) -> bool,}first by f(a, b): true if a comes before b
By.less
Section titled “By.less”pub less :: fn(self: *Self, a: T, b: T) -> boolPriorityQueue
Section titled “PriorityQueue”pub PriorityQueue :: struct($T: type, $C: type) { region: *Arena, data: []T, count: usize, order: C,}region: where it grows (borrowed)data: heap, data[0] first; cap == data.len
PriorityQueue.len
Section titled “PriorityQueue.len”pub len :: fn(self: *Self) -> usizePriorityQueue.is_empty
Section titled “PriorityQueue.is_empty”pub is_empty :: fn(self: *Self) -> boolPriorityQueue.peek
Section titled “PriorityQueue.peek”pub peek :: fn(self: *Self) -> ?Tnext pop result, left in place; null if empty
PriorityQueue.push
Section titled “PriorityQueue.push”pub push :: fn(self: *Self, item: T)PriorityQueue.push_all
Section titled “PriorityQueue.push_all”pub push_all :: fn(self: *Self, items: []const T)push each of items
PriorityQueue.pop
Section titled “PriorityQueue.pop”pub pop :: fn(self: *Self) -> ?Ttake the first; null if empty
PriorityQueue.items
Section titled “PriorityQueue.items”pub items :: fn(self: *Self) -> []Tunordered; valid until the next push
PriorityQueue.clear
Section titled “PriorityQueue.clear”pub clear :: fn(self: *Self)pub with :: fn($T: type, $C: type, a: *Arena, order: C) -> PriorityQueue(T, C)queue in a; order decides what comes first
pub min :: fn($T: type, a: *Arena) -> PriorityQueue(T, Min(T))smallest first
pub max :: fn($T: type, a: *Arena) -> PriorityQueue(T, Max(T))largest first
pub by :: fn($T: type, a: *Arena, less: fn(T, T) -> bool) -> PriorityQueue(T, By(T))first by less(a, b): true if a comes before b