pub struct MinimizerQueue<T: Hash + Copy, S: BuildHasher = DefaultHashBuilder> { /* 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 multiple_mins(&self) -> bool
pub fn multiple_mins(&self) -> bool
Returns true
if there are multiple minimizers in the queue.
Sourcepub fn get_min_pos(&self) -> (T, usize)
pub fn get_min_pos(&self) -> (T, usize)
Returns the leftmost minimizer and its relative position in the queue.
Sourcepub fn get_inner_min_pos(&self) -> (T, usize, Option<(T, usize)>)
pub fn get_inner_min_pos(&self) -> (T, usize, Option<(T, usize)>)
Returns the innermost minimizer and its relative position in the queue, with a second choice in case of tie.
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