pub struct Cursor<Err> { /* private fields */ }Expand description
Wrapper for IDBCursorWithValue
Implementations§
Source§impl<Err> Cursor<Err>
impl<Err> Cursor<Err>
Sourcepub fn value(&self) -> Option<JsValue>
pub fn value(&self) -> Option<JsValue>
Retrieve the value this Cursor is currently pointing at, or None if the cursor is completed
If this cursor was opened as a key-only cursor, then trying to call this method will panic.
Internally, this uses the IDBCursorWithValue::value property.
Sourcepub fn key(&self) -> Option<JsValue>
pub fn key(&self) -> Option<JsValue>
Retrieve the key this Cursor is currently pointing at, or None if the cursor is completed
Internally, this uses the IDBCursor::key property.
Sourcepub fn primary_key(&self) -> Option<JsValue>
pub fn primary_key(&self) -> Option<JsValue>
Retrieve the primary key this Cursor is currently pointing at, or None if the cursor is completed
Internally, this uses the IDBCursor::primaryKey property.
Sourcepub async fn advance(&mut self, count: u32) -> Result<(), Err>
pub async fn advance(&mut self, count: u32) -> Result<(), Err>
Advance this Cursor by count elements
Internally, this uses IDBCursor::advance.
Sourcepub async fn advance_until(&mut self, key: &JsValue) -> Result<(), Err>
pub async fn advance_until(&mut self, key: &JsValue) -> Result<(), Err>
Advance this Cursor until the provided key
Internally, this uses IDBCursor::continue.
Sourcepub async fn advance_until_primary_key(
&mut self,
index_key: &JsValue,
primary_key: &JsValue,
) -> Result<(), Err>
pub async fn advance_until_primary_key( &mut self, index_key: &JsValue, primary_key: &JsValue, ) -> Result<(), Err>
Advance this Cursor until the provided primary key
This is a helper function for cursors built on top of Indexes. It allows for
quick resumption of index walking, faster than Cursor::advance_until if the
primary key for the wanted element is known.
Note that this method does not work on cursors over object stores, nor on cursors
which are set with a direction of anything other than Next or Prev.
Internally, this uses IDBCursor::continuePrimaryKey.