[−][src]Struct milkpq::MilkPQ
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 None
s 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]
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
[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]
pub fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl<T: Ord> From<MilkPQ<T>> for Vec<T>
[src]
impl<T: Ord> FromIterator<T> for MilkPQ<T>
[src]
pub fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
[src]
impl<T: Ord> IntoIterator for MilkPQ<T>
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for MilkPQ<T>
impl<T> Send for MilkPQ<T> where
T: Send,
T: Send,
impl<T> Sync for MilkPQ<T> where
T: Sync,
T: Sync,
impl<T> Unpin for MilkPQ<T>
impl<T> UnwindSafe for MilkPQ<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,