[][src]Struct cranelift_bforest::MapCursor

pub struct MapCursor<'a, K, V, C> where
    K: 'a + Copy,
    V: 'a + Copy,
    C: 'a + Comparator<K>, 
{ /* fields omitted */ }

A position in a Map used to navigate and modify the ordered map.

A cursor always points at a key-value pair in the map, or "off the end" which is a position after the last entry in the map.

Methods

impl<'a, K, V, C> MapCursor<'a, K, V, C> where
    K: Copy,
    V: Copy,
    C: Comparator<K>, 
[src]

pub fn is_empty(&self) -> bool[src]

Is this cursor pointing to an empty map?

pub fn next(&mut self) -> Option<(K, V)>[src]

Move cursor to the next key-value pair and return it.

If the cursor reaches the end, return None and leave the cursor at the off-the-end position.

pub fn prev(&mut self) -> Option<(K, V)>[src]

Move cursor to the previous key-value pair and return it.

If the cursor is already pointing at the first entry, leave it there and return None.

pub fn key(&self) -> Option<K>[src]

Get the current key, or None if the cursor is at the end.

pub fn value(&self) -> Option<V>[src]

Get the current value, or None if the cursor is at the end.

pub fn value_mut(&mut self) -> Option<&mut V>[src]

Get a mutable reference to the current value, or None if the cursor is at the end.

pub fn goto(&mut self, elem: K) -> Option<V>[src]

Move this cursor to key.

If key is in the map, place the cursor at key and return the corresponding value.

If key is not in the set, place the cursor at the next larger element (or the end) and return None.

pub fn goto_first(&mut self) -> Option<V>[src]

Move this cursor to the first element.

pub fn insert(&mut self, key: K, value: V) -> Option<V>[src]

Insert (key, value)) into the map and leave the cursor at the inserted pair.

If the map did not contain key, return None.

If key is already present, replace the existing with value and return the old value.

pub fn remove(&mut self) -> Option<V>[src]

Remove the current entry (if any) and return the mapped value. This advances the cursor to the next entry after the removed one.

Auto Trait Implementations

impl<'a, K, V, C> Send for MapCursor<'a, K, V, C> where
    C: Sync,
    K: Send,
    V: Send

impl<'a, K, V, C> Sync for MapCursor<'a, K, V, C> where
    C: Sync,
    K: Sync,
    V: Sync

impl<'a, K, V, C> Unpin for MapCursor<'a, K, V, C> where
    K: Unpin,
    V: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.