[][src]Struct cranelift_bforest::SetCursor

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

A position in a Set used to navigate and modify the ordered set.

A cursor always points at an element in the set, or "off the end" which is a position after the last element in the set.

Methods

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

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

Is this cursor pointing to an empty set?

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

Move cursor to the next element 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>[src]

Move cursor to the previous element and return it.

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

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

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

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

Move this cursor to elem.

If elem is in the set, place the cursor at elem and return true.

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

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

Move this cursor to the first element.

pub fn insert(&mut self, elem: K) -> bool[src]

Try to insert elem into the set and leave the cursor at the inserted element.

If the set did not contain elem, insert it and return true.

If elem is already present, don't change the set, place the cursor at goto(elem), and return false.

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

Remove the current element (if any) and return it. This advances the cursor to the next element after the removed one.

Auto Trait Implementations

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

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

Blanket Implementations

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

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

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

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