Struct cranelift_bforest::SetCursor
source · [−]pub struct SetCursor<'a, K, C> where
K: 'a + Copy,
C: 'a + Comparator<K>, { /* private fields */ }
Expand description
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.
Implementations
sourceimpl<'a, K, C> SetCursor<'a, K, C> where
K: Copy,
C: Comparator<K>,
impl<'a, K, C> SetCursor<'a, K, C> where
K: Copy,
C: Comparator<K>,
sourcepub fn next(&mut self) -> Option<K>
pub fn next(&mut self) -> Option<K>
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.
sourcepub fn prev(&mut self) -> Option<K>
pub fn prev(&mut self) -> Option<K>
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
.
sourcepub fn goto(&mut self, elem: K) -> bool
pub fn goto(&mut self, elem: K) -> bool
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.
sourcepub fn goto_first(&mut self) -> Option<K>
pub fn goto_first(&mut self) -> Option<K>
Move this cursor to the first element.
Auto Trait Implementations
impl<'a, K, C> RefUnwindSafe for SetCursor<'a, K, C> where
C: RefUnwindSafe,
K: RefUnwindSafe,
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,
impl<'a, K, C> Unpin for SetCursor<'a, K, C> where
K: Unpin,
impl<'a, K, C> !UnwindSafe for SetCursor<'a, K, C>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more