Struct QMap

Source
pub struct QMap<K: Eq + Hash + Clone, O: Ord + Copy> { /* private fields */ }

Implementations§

Source§

impl<K: Eq + Hash + Clone, O: Ord + Copy> QMap<K, O>

Source

pub fn new() -> Self

Source

pub fn len(&self) -> usize

Source

pub fn upsert(&mut self, key: K, order_by: O)

Inserts key at order_by position in the queue. key gets overwritten and given new queue position if exists.

Source

pub fn delete(&mut self, key: &K)

Deletes key and its position in the queue.

Source

pub fn position(&self, key: &K) -> Option<&O>

Tells the position of key in the queue. Returns None if key is not in store.

Source

pub fn front(&self) -> Option<(&O, &K)>

Source

pub fn back(&self) -> Option<(&O, &K)>

Source

pub fn pop_front(&mut self) -> Option<(O, K)>

Source

pub fn pop_back(&mut self) -> Option<(O, K)>

Source

pub fn pop_front_until(&mut self, until: &O) -> Vec<(O, K)>

Pops elements from the front of the queue whose position is less than (inclusive) until. Less than means further front.

Source

pub fn pop_back_until(&mut self, until: &O) -> Vec<(O, K)>

Pops elements from the back of the queue whose position is greater than (inclusive) until. Greater than means further back.

Source

pub fn push_front( &mut self, key: K, order_by: O, ) -> Result<(), InvalidOrder<(O, K)>>

Source

pub fn push_back( &mut self, key: K, order_by: O, ) -> Result<(), InvalidOrder<(O, K)>>

Auto Trait Implementations§

§

impl<K, O> Freeze for QMap<K, O>

§

impl<K, O> RefUnwindSafe for QMap<K, O>

§

impl<K, O> Send for QMap<K, O>
where K: Send, O: Send,

§

impl<K, O> Sync for QMap<K, O>
where K: Sync, O: Sync,

§

impl<K, O> Unpin for QMap<K, O>
where K: Unpin, O: Unpin,

§

impl<K, O> UnwindSafe for QMap<K, O>
where K: UnwindSafe, O: 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.