PQueueOperations

Trait PQueueOperations 

Source
pub trait PQueueOperations<T> {
    // Required methods
    fn new() -> Self;
    fn update(&self, item: T, new_score: i64);
    fn peek(&self) -> Option<T>;
    fn next(&self) -> Option<T>;
    fn score(&self, item: &T) -> Option<i64>;
    fn stats(&self) -> PQueueStats;
}
Expand description

Trait defining the core operations for a priority queue. This abstraction allows for different implementations while maintaining a consistent API.

Required Methods§

Source

fn new() -> Self

Creates a new empty priority queue.

Source

fn update(&self, item: T, new_score: i64)

Updates an item’s score (additive) or adds it if it doesn’t exist.

Source

fn peek(&self) -> Option<T>

Returns the highest-scoring item without removing it.

Source

fn next(&self) -> Option<T>

Removes and returns the highest-scoring item.

Source

fn score(&self, item: &T) -> Option<i64>

Gets the current score for a specific item.

Source

fn stats(&self) -> PQueueStats

Returns current queue statistics.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§