Struct froggy::CursorItem
[−]
[src]
pub struct CursorItem<'a, T: 'a> { /* fields omitted */ }
Item of the streaming iterator.
Cursor
and CursorItem
are extremely useful
when you need to iterate over Pointers
in storage
with ability to get other component in the same storage during iterating.
Examples
Unfortunately, you can't use common for
loop,
but you can use while let
statement:
let mut cursor = storage.cursor(); while let Some(item) = cursor.next() { // ... your code }
While iterating, you can pin
item
with Pointer.
#[derive(Debug, PartialEq)] struct Node { pointer: Option<WeakPointer<Node>>, } //... let mut cursor = storage.cursor(); while let Some((left, mut item, _)) = cursor.next() { // let's look for the other Node match item.pointer { Some(ref pointer) => { let ref pointer = pointer.upgrade()?; if let Some(ref other_node) = left.get(pointer) { do_something(other_node); } }, None => {}, } }
Methods
impl<'a, T> CursorItem<'a, T>
[src]
Trait Implementations
impl<'a, T: Debug + 'a> Debug for CursorItem<'a, T>
[src]
impl<'a, T> Deref for CursorItem<'a, T>
[src]
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &T
[src]
Dereferences the value.