Struct linked_vector::Cursor
source · pub struct Cursor<'a, T> { /* private fields */ }
Expand description
A cursor which can only read the elements of the list.
Trait Implementations§
source§impl<'a, T> CursorBase<T> for Cursor<'a, T>
impl<'a, T> CursorBase<T> for Cursor<'a, T>
source§fn get(&self) -> Option<&T>
fn get(&self) -> Option<&T>
Returns a reference to the element at the cursor’s current position,
or
None
if the underlying vector is empty. Enable the
"optionless-accessors"
feature to remove the Option
from the return
type, see usage notes. Read moresource§fn node(&self) -> HNode
fn node(&self) -> HNode
Returns the handle of the element at the cursor’s current position. Read more
source§fn move_to(&mut self, handle: HNode) -> bool
fn move_to(&mut self, handle: HNode) -> bool
Moves the cursor to the specified handle. The handle must be valid.
Returns true if the move was successful. If the
"optionless-accessors"
feature is enabled, this method doesn’t return a value. This feature is
disabled by default, see
usage notes. Read moresource§fn move_next(&mut self) -> Option<HNode>
fn move_next(&mut self) -> Option<HNode>
Moves the cursor to the next element. Returns the handle of the next
element if the cursor was moved, None if the cursor was already at the
end of the list. Read more
source§fn move_prev(&mut self) -> Option<HNode>
fn move_prev(&mut self) -> Option<HNode>
Moves the cursor to the previous element. Returns the handle of the
previous element if the cursor was moved, None if the cursor was
already at the start of the list. Read more
source§fn move_to_front(&mut self) -> Option<HNode>
fn move_to_front(&mut self) -> Option<HNode>
Moves the cursor to the start of the list. Returns the handle of the
first element if the cursor was moved, None if the list is empty. Read more
source§fn move_to_back(&mut self) -> Option<HNode>
fn move_to_back(&mut self) -> Option<HNode>
Moves the cursor to the end of the list. Returns the handle of the
last element if the cursor was moved, None if the list is empty. Read more
source§fn move_to_start(&mut self) -> Option<HNode>
fn move_to_start(&mut self) -> Option<HNode>
👎Deprecated since 1.1.0: Use move_to_front() instead.
Moves the cursor to the start of the list. Returns the handle of the
first element if the cursor was moved, None if the list is empty. Read more
source§fn move_to_end(&mut self) -> Option<HNode>
fn move_to_end(&mut self) -> Option<HNode>
👎Deprecated since 1.1.0: Use move_to_back() instead.
Moves the cursor to the end of the list. Returns the handle of the
last element if the cursor was moved, None if the list is empty. Read more
source§fn forward(&mut self, n: usize) -> Result<HNode, HNode>
fn forward(&mut self, n: usize) -> Result<HNode, HNode>
Moves the cursor forward by the specified number of elements. Returns
the handle of the element at the new position if the cursor was moved,
Err(handle) if the cursor did not move forward by the specified amount.
The handle at the current position after the move is returned in
either Result variant. Read more
source§fn backward(&mut self, n: usize) -> Result<HNode, HNode>
fn backward(&mut self, n: usize) -> Result<HNode, HNode>
Moves the cursor backward by the specified number of elements. Returns
the handle of the element at the new position if the cursor was moved,
Err(handle) if the cursor did not move backward by the specified amount.
The handle at the current position after the move is returned in
either Result variant. Read more