Struct SplayMap

Source
pub struct SplayMap<K, V, A = MemoryPool<Node<((K, V), usize)>>>
where A: Allocator<Node<((K, V), usize)>>,
{ /* private fields */ }

Implementations§

Source§

impl<K, V> SplayMap<K, V>

Source

pub fn new() -> Self

Source

pub fn with_capacity(capacity: usize) -> Self

Source§

impl<K, V, A> SplayMap<K, V, A>
where A: Allocator<Node<((K, V), usize)>>,

Source

pub fn get<Q>(&mut self, key: &Q) -> Option<&V>
where K: Borrow<Q>, Q: Ord + ?Sized,

Source

pub fn get_key_value<Q>(&mut self, key: &Q) -> Option<(&K, &V)>
where K: Borrow<Q>, Q: Ord + ?Sized,

Examples found in repository?
crates/competitive/src/data_structure/splay_tree/sized_map.rs (line 154)
149    pub fn get<Q>(&mut self, key: &Q) -> Option<&V>
150    where
151        K: Borrow<Q>,
152        Q: Ord + ?Sized,
153    {
154        self.get_key_value(key).map(|(_, v)| v)
155    }
Source

pub fn get_key_value_at(&mut self, index: usize) -> Option<(&K, &V)>

Source

pub fn insert(&mut self, key: K, value: V) -> Option<V>
where K: Ord,

Source

pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
where K: Borrow<Q>, Q: Ord + ?Sized,

Source

pub fn remove_at(&mut self, index: usize) -> Option<(K, V)>

Source

pub fn len(&self) -> usize

Examples found in repository?
crates/competitive/src/data_structure/splay_tree/sized_map.rs (line 242)
241    pub fn is_empty(&self) -> bool {
242        self.len() == 0
243    }
Source

pub fn is_empty(&self) -> bool

Source

pub fn iter(&mut self) -> Iter<'_, K, V>

Source

pub fn range<Q, R>(&mut self, range: R) -> Iter<'_, K, V>
where K: Borrow<Q>, Q: Ord + ?Sized, R: RangeBounds<Q>,

Source

pub fn range_at<R>(&mut self, range: R) -> Iter<'_, K, V>
where R: RangeBounds<usize>,

Trait Implementations§

Source§

impl<K, V, A> Debug for SplayMap<K, V, A>
where K: Debug, V: Debug, A: Allocator<Node<((K, V), usize)>>,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K, V, A> Default for SplayMap<K, V, A>
where A: Allocator<Node<((K, V), usize)>> + Default,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<K, V, A> Drop for SplayMap<K, V, A>
where A: Allocator<Node<((K, V), usize)>>,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<K, V, A> Freeze for SplayMap<K, V, A>
where A: Freeze,

§

impl<K, V, A> RefUnwindSafe for SplayMap<K, V, A>

§

impl<K, V, A = MemoryPool<Node<((K, V), usize)>>> !Send for SplayMap<K, V, A>

§

impl<K, V, A = MemoryPool<Node<((K, V), usize)>>> !Sync for SplayMap<K, V, A>

§

impl<K, V, A> Unpin for SplayMap<K, V, A>
where A: Unpin,

§

impl<K, V, A> UnwindSafe for SplayMap<K, V, A>

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.