pub struct DHeap<T: Eq + Hash + Clone + Display + PartialEq> { /* private fields */ }
Implementations§
Source§impl<T: Eq + Hash + Clone + Display + PartialEq> DHeap<T>
impl<T: Eq + Hash + Clone + Display + PartialEq> DHeap<T>
Sourcepub fn new(
initial_capacity: Option<usize>,
branching_factor: Option<usize>,
) -> Self
pub fn new( initial_capacity: Option<usize>, branching_factor: Option<usize>, ) -> Self
Creates a new heap
Sourcepub fn with_pairs(
data: &[Pair<T>],
initial_capacity: Option<usize>,
branching_factor: Option<usize>,
) -> Result<Self>
pub fn with_pairs( data: &[Pair<T>], initial_capacity: Option<usize>, branching_factor: Option<usize>, ) -> Result<Self>
Accepts a slice of pairs and creates a heap
Sourcepub fn insert_value(&mut self, element: T, priority: usize) -> Result<(), Error>
pub fn insert_value(&mut self, element: T, priority: usize) -> Result<(), Error>
Inserts the value
Sourcepub fn peek(&self) -> Option<&Pair<T>>
pub fn peek(&self) -> Option<&Pair<T>>
Returns the highest priority value without taking it out of the queue If empty, returns None
Sourcepub fn top(&mut self) -> Option<Pair<T>>
pub fn top(&mut self) -> Option<Pair<T>>
Returns the highest priority value. This operation take the value out of the queue If empty, returns None
Sourcepub fn update_priority(&mut self, old_value: T, new_priority: usize)
pub fn update_priority(&mut self, old_value: T, new_priority: usize)
Finds and update priority of the value
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for DHeap<T>
impl<T> RefUnwindSafe for DHeap<T>where
T: RefUnwindSafe,
impl<T> Send for DHeap<T>where
T: Send,
impl<T> Sync for DHeap<T>where
T: Sync,
impl<T> Unpin for DHeap<T>where
T: Unpin,
impl<T> UnwindSafe for DHeap<T>where
T: UnwindSafe,
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