pub struct ImplicitMinimizerQueue<S: BuildHasher = DefaultHashBuilder> { /* private fields */ }
Expand description
A monotone queue that can compute the positions of consecutive minimizers in constant time.
§Examples
use minimizer_queue::ImplicitMinimizerQueue;
let mut queue = ImplicitMinimizerQueue::new(3); // width 3
queue.insert(&1);
queue.insert(&2);
queue.insert(&3);
queue.get_min_pos(); // position of the element with the smallest hash among 1, 2 and 3
queue.insert(&4);
queue.get_min_pos(); // position of the element with the smallest hash among 2, 3 and 4
Implementations§
Source§impl<S: BuildHasher> ImplicitMinimizerQueue<S>
impl<S: BuildHasher> ImplicitMinimizerQueue<S>
Sourcepub fn with_hasher(width: u16, hash_builder: S) -> Self
pub fn with_hasher(width: u16, hash_builder: S) -> Self
Creates an empty ImplicitMinimizerQueue
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) -> usize
pub fn get_min_pos(&self) -> usize
Returns the relative position of the leftmost minimizer.
Sourcepub fn get_inner_min_pos(&self) -> (usize, Option<usize>)
pub fn get_inner_min_pos(&self) -> (usize, Option<usize>)
Returns the relative position of the innermost minimizer, with a second choice in case of tie.
Sourcepub fn insert<T: Hash>(&mut self, x: &T)
pub fn insert<T: Hash>(&mut self, x: &T)
Inserts x
in the queue and updates the current minimizer.
Sourcepub fn insert_hash(&mut self, hash: u64)
pub fn insert_hash(&mut self, hash: u64)
Inserts x
in the queue with the given hash and updates the current minimizer.
Auto Trait Implementations§
impl<S> Freeze for ImplicitMinimizerQueue<S>where
S: Freeze,
impl<S> RefUnwindSafe for ImplicitMinimizerQueue<S>where
S: RefUnwindSafe,
impl<S> Send for ImplicitMinimizerQueue<S>where
S: Send,
impl<S> Sync for ImplicitMinimizerQueue<S>where
S: Sync,
impl<S> Unpin for ImplicitMinimizerQueue<S>where
S: Unpin,
impl<S> UnwindSafe for ImplicitMinimizerQueue<S>where
S: 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