pub struct PrioritySet<I: Ord + Hash + Clone, P: Ord + Copy> { /* private fields */ }
Expand description
A set that offers efficient iteration over its elements in priority-ascending order.
Implementations§
Source§impl<I: Ord + Hash + Clone, P: Ord + Copy> PrioritySet<I, P>
impl<I: Ord + Hash + Clone, P: Ord + Copy> PrioritySet<I, P>
Sourcepub fn put(&mut self, item: I, priority: P)
pub fn put(&mut self, item: I, priority: P)
Insert an item with a priority, overwriting the previous priority if it exists.
Sourcepub fn remove(&mut self, item: &I) -> bool
pub fn remove(&mut self, item: &I) -> bool
Remove an item from the set.
Returns true
if the item was present.
Sourcepub fn reconcile(&mut self, keep: &[I], default: P)
pub fn reconcile(&mut self, keep: &[I], default: P)
Remove all previously inserted items not included in keep
and add any items not yet seen with a priority of initial
.
Sourcepub fn pop(&mut self) -> Option<(I, P)>
pub fn pop(&mut self) -> Option<(I, P)>
Removes and returns the item with the highest priority.
Auto Trait Implementations§
impl<I, P> Freeze for PrioritySet<I, P>
impl<I, P> RefUnwindSafe for PrioritySet<I, P>where
I: RefUnwindSafe,
P: RefUnwindSafe,
impl<I, P> Send for PrioritySet<I, P>
impl<I, P> Sync for PrioritySet<I, P>
impl<I, P> Unpin for PrioritySet<I, P>
impl<I, P> UnwindSafe for PrioritySet<I, P>
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