[][src]Struct milkpq::MilkPQ

pub struct MilkPQ<T: Ord> { /* fields omitted */ }

docs

Implementations

impl<T: Ord> MilkPQ<T>[src]

pub fn new() -> Self[src]

Create a new MilkPQ priority queue.

pub fn with_capacity(cap: usize) -> Self[src]

Create a new MilkPQ with each subqueue having cap capacity.

pub fn with_queues(limit: usize) -> Self[src]

Create a new MilkPQ with a given number of subqueues.

pub fn with_capacity_and_queues(cap: usize, limit: usize) -> Self[src]

Create a new MilkPQ with a given capacity and subqueue count.

See [with_capacity()] and [with_queues()], as this is just a combination of the two.

pub fn push(&self, t: T)[src]

Push an element into a subqueue.

pub fn pop(&self) -> Option<T>[src]

Pop the maximum element in a priority subqueue.

This works by trying to lock a random subqueue and popping an element from that. Thus, this can have spurious Nones when some subqueues are empty while others are not. For a function that is guaranteed to pop an element if any exist in any subqueues, see [strong_pop()].

pub fn strong_pop(&self) -> Option<T>[src]

Pop an element from the priority queue, but non-spuriously.

This will check every subqueue until it finds some element (not necessarily the maximum in the whole structure) and returns it, or will return None. Thus, it returns None iff the structure is truly empty.

pub fn into_sorted_vec(self) -> Vec<T>[src]

Turns self into a descending sorted Vec.

pub fn clear(&self)[src]

Clears all subqueues in the structure.

pub fn drain(&mut self) -> Vec<T>[src]

Empty the contents of self into a Vec and leave self empty.

pub fn extend_ref<I: IntoIterator<Item = T>>(&self, iter: I)[src]

Extend self using an IntoIterator.

Exactly like Extend, except it doesn't mutably borrow self.

Trait Implementations

impl<T: Ord + Clone> Clone for MilkPQ<T>[src]

impl<T: Ord + Debug> Debug for MilkPQ<T>[src]

impl<T: Ord> Default for MilkPQ<T>[src]

impl<T: Ord> Extend<T> for MilkPQ<T>[src]

impl<T: Ord> From<MilkPQ<T>> for Vec<T>[src]

impl<T: Ord> FromIterator<T> for MilkPQ<T>[src]

impl<T: Ord> IntoIterator for MilkPQ<T>[src]

type Item = T

The type of the elements being iterated over.

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<T> !RefUnwindSafe for MilkPQ<T>

impl<T> Send for MilkPQ<T> where
    T: Send

impl<T> Sync for MilkPQ<T> where
    T: Sync

impl<T> Unpin for MilkPQ<T>

impl<T> UnwindSafe for MilkPQ<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,