pub struct BucketQueue<T, P, C, Q, Storer>where
C: CoarseGrainedPriority<P> + Hash + Ord + Clone,
P: Ord,
Q: AbstractPriorityQueue<T, P>,
Storer: IndexInto<C, Q>,{ /* private fields */ }Expand description
the items of type T and priority P being stored are being stored in one of potentially
several Q’s which are all the same kind of AbstractPriorityQueue for such items and priorities
but they are divided up by the coarsed grained priority
so each one of those are smaller and only storing items with priorities with the same
coarse grained priority
Implementations§
Source§impl<T, P, C, Q, Storer> BucketQueue<T, P, C, Q, Storer>where
C: CoarseGrainedPriority<P> + Hash + Ord + Clone,
P: Ord,
Q: AbstractPriorityQueue<T, P>,
Storer: IndexInto<C, Q>,
impl<T, P, C, Q, Storer> BucketQueue<T, P, C, Q, Storer>where
C: CoarseGrainedPriority<P> + Hash + Ord + Clone,
P: Ord,
Q: AbstractPriorityQueue<T, P>,
Storer: IndexInto<C, Q>,
Sourcepub fn new(
lower_bound_occupied_bucket: C,
upper_bound_occupied_bucket: C,
dummy: &Q,
) -> Self
pub fn new( lower_bound_occupied_bucket: C, upper_bound_occupied_bucket: C, dummy: &Q, ) -> Self
pass a lower and upper bound for the coarse grained priorities you are expecting to see these don’t have to be accurate, but if you pass them accurately it is better you also pass an example of Q that is to be used for constructing new buckets
Trait Implementations§
Source§impl<T, P, C, Q, Storer> AbstractPriorityQueue<T, P> for BucketQueue<T, P, C, Q, Storer>where
C: CoarseGrainedPriority<P> + Hash + Ord + Clone,
P: Ord,
Q: AbstractPriorityQueue<T, P>,
Storer: IndexInto<C, Q>,
impl<T, P, C, Q, Storer> AbstractPriorityQueue<T, P> for BucketQueue<T, P, C, Q, Storer>where
C: CoarseGrainedPriority<P> + Hash + Ord + Clone,
P: Ord,
Q: AbstractPriorityQueue<T, P>,
Storer: IndexInto<C, Q>,
Source§fn empty_copy(&self) -> Self
fn empty_copy(&self) -> Self
a version just like self
but without any actual items
Source§fn my_enqueue(&mut self, new_obj: T, new_obj_priority: P)
fn my_enqueue(&mut self, new_obj: T, new_obj_priority: P)
insert an item with specified priority
Source§fn enqueue_batch(
&mut self,
new_batch: impl IntoIterator<Item = T>,
new_batch_priority: P,
)
fn enqueue_batch( &mut self, new_batch: impl IntoIterator<Item = T>, new_batch_priority: P, )
enqueueing many items all with the same priority, might have a faster implementation than
just doing them one by one
Source§fn my_dequeue(&mut self) -> Option<(T, P)>
fn my_dequeue(&mut self) -> Option<(T, P)>
if nonempty, one item comes out
the order is dependent on the specific implementation
and how it handles priorities
Source§fn dequeue_batch(
&mut self,
around_how_many: usize,
hard_limit: usize,
) -> Vec<(T, P)>
fn dequeue_batch( &mut self, around_how_many: usize, hard_limit: usize, ) -> Vec<(T, P)>
if there are fewer than
around_how_many gives all of the items in the queue
if there are more than that, give some number of items
that is at least around_how_many but less than or equal to than the hard limit
where how much more depends on the specific implementer and the specific items involvedfn enqueue_many(&mut self, new_obj_and_priorities: impl Iterator<Item = (T, P)>)
Source§fn all_items_iter(self) -> impl Iterator<Item = T>where
Self: Sized,
fn all_items_iter(self) -> impl Iterator<Item = T>where
Self: Sized,
with no more items being enqueue’d
we can just dequeue them all and provide an iterator
over all the items ignoring their priorities
Auto Trait Implementations§
impl<T, P, C, Q, Storer> Freeze for BucketQueue<T, P, C, Q, Storer>
impl<T, P, C, Q, Storer> RefUnwindSafe for BucketQueue<T, P, C, Q, Storer>where
Storer: RefUnwindSafe,
C: RefUnwindSafe,
Q: RefUnwindSafe,
T: RefUnwindSafe,
P: RefUnwindSafe,
impl<T, P, C, Q, Storer> Send for BucketQueue<T, P, C, Q, Storer>
impl<T, P, C, Q, Storer> Sync for BucketQueue<T, P, C, Q, Storer>
impl<T, P, C, Q, Storer> Unpin for BucketQueue<T, P, C, Q, Storer>
impl<T, P, C, Q, Storer> UnwindSafe for BucketQueue<T, P, C, Q, Storer>
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