Queue

Struct Queue 

Source
pub struct Queue<H, Cost>
where H: Handle, Cost: PartialOrd,
{ /* private fields */ }
Expand description

Priorty queue implementation for mesh elements.

When you pop an element, the one with the lowest cost is removed from the queue and returned.

Implementations§

Source§

impl<H, Cost> Queue<H, Cost>
where H: Handle, Cost: PartialOrd,

Source

pub fn new(num_items: usize) -> Self

Create a new heap with the number of elements.

For example, if the heap is meant to be used to queue up vertices of a mesh, provide the number of vertices in that mesh.

Source

pub fn clear(&mut self)

Clear the queue.

Source

pub fn len(&self) -> usize

Number of items currently in the queue.

Source

pub fn is_empty(&self) -> bool

Check if this queue is empty.

Source

pub fn insert(&mut self, val: H, cost: Cost)

Insert the given handle val and cost into the heap.

If the handle is already present in the heap, it will be updated to have the new cost.

Source

pub fn remove(&mut self, val: H)

Remove an element from the queue, if it is present.

Source

pub fn pop(&mut self) -> Option<(H, Cost)>

Remove the item from the front of the queue and return it.

Auto Trait Implementations§

§

impl<H, Cost> Freeze for Queue<H, Cost>

§

impl<H, Cost> RefUnwindSafe for Queue<H, Cost>
where H: RefUnwindSafe, Cost: RefUnwindSafe,

§

impl<H, Cost> Send for Queue<H, Cost>
where H: Send, Cost: Send,

§

impl<H, Cost> Sync for Queue<H, Cost>
where H: Sync, Cost: Sync,

§

impl<H, Cost> Unpin for Queue<H, Cost>
where H: Unpin, Cost: Unpin,

§

impl<H, Cost> UnwindSafe for Queue<H, Cost>
where H: UnwindSafe, Cost: 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.