BucketQueue

Struct BucketQueue 

Source
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>,

Source

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>,

Source§

fn empty_copy(&self) -> Self

a version just like self but without any actual items
Source§

fn my_peek(&self) -> Option<(&T, &P)>

what would my_dequeue give
Source§

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, )

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)>

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)>

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 involved
Source§

fn my_len(&self) -> usize

how many items are present
Source§

fn is_empty(&self) -> bool

is the queue empty
Source§

fn 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,

with no more items being enqueue’d we can just dequeue them all and provide an iterator over all the items ignoring their priorities
Source§

fn drain_all(&mut self) -> Vec<(T, P)>

dequeue them all but after the mutable reference issues resolved more items can still be enqueue’d unlike all_items_iter which closed this off
Source§

impl<T, P, C, Q, Storer> Default for BucketQueue<T, P, C, Q, Storer>
where C: CoarseGrainedPriority<P> + Hash + Ord + Clone + Default, P: Ord, Q: AbstractPriorityQueue<T, P> + Default, Storer: IndexInto<C, Q>,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T, P, C, Q, Storer> Freeze for BucketQueue<T, P, C, Q, Storer>
where Storer: Freeze, C: Freeze, Q: Freeze,

§

impl<T, P, C, Q, Storer> RefUnwindSafe for BucketQueue<T, P, C, Q, Storer>

§

impl<T, P, C, Q, Storer> Send for BucketQueue<T, P, C, Q, Storer>
where Storer: Send, C: Send, Q: Send, T: Send, P: Send,

§

impl<T, P, C, Q, Storer> Sync for BucketQueue<T, P, C, Q, Storer>
where Storer: Sync, C: Sync, Q: Sync, T: Sync, P: Sync,

§

impl<T, P, C, Q, Storer> Unpin for BucketQueue<T, P, C, Q, Storer>
where Storer: Unpin, C: Unpin, Q: Unpin, T: Unpin, P: Unpin,

§

impl<T, P, C, Q, Storer> UnwindSafe for BucketQueue<T, P, C, Q, Storer>
where Storer: UnwindSafe, C: UnwindSafe, Q: UnwindSafe, T: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.