Struct minimizer_queue::MinimizerQueue
source · pub struct MinimizerQueue<T: Hash + Copy, S: BuildHasher = WyHash> { /* private fields */ }
Expand description
A monotone queue that can compute consecutive minimizers in constant time.
§Examples
use minimizer_queue::MinimizerQueue;
let mut queue = MinimizerQueue::new(3); // width 3
queue.insert(1);
queue.insert(2);
queue.insert(3);
queue.get_min(); // element with the smallest hash among 1, 2 and 3
queue.insert(4);
queue.get_min(); // element with the smallest hash among 2, 3 and 4
Implementations§
source§impl<T: Hash + Copy> MinimizerQueue<T>
impl<T: Hash + Copy> MinimizerQueue<T>
source§impl<T: Hash + Copy, S: BuildHasher> MinimizerQueue<T, S>
impl<T: Hash + Copy, S: BuildHasher> MinimizerQueue<T, S>
sourcepub fn with_hasher(width: u16, hash_builder: S) -> Self
pub fn with_hasher(width: u16, hash_builder: S) -> Self
Creates an empty MinimizerQueue
with the given width and hasher.
The hasher will define the ordering of the minimizers, based on their hashes.
sourcepub fn get_min_pos(&self) -> (T, usize)
pub fn get_min_pos(&self) -> (T, usize)
Returns the current minimizer and its relative position in the queue.
sourcepub fn insert_with_hash(&mut self, x: T, hash: u64)
pub fn insert_with_hash(&mut self, x: T, hash: u64)
Inserts x
in the queue with the given hash and updates the current minimizer.
Auto Trait Implementations§
impl<T, S> Freeze for MinimizerQueue<T, S>where
S: Freeze,
impl<T, S> RefUnwindSafe for MinimizerQueue<T, S>where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for MinimizerQueue<T, S>
impl<T, S> Sync for MinimizerQueue<T, S>
impl<T, S> Unpin for MinimizerQueue<T, S>
impl<T, S> UnwindSafe for MinimizerQueue<T, S>where
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more