#[non_exhaustive]pub struct IndexCursor {
pub value: IndexValue,
pub key: Vec<u8>,
}Expand description
Opaque pagination cursor: the last (value, key) served. Encoded
by the runtime into the wire cursor; None = start.
use kevy_index::{Cursor, IndexValue};
let c = Cursor::new(IndexValue::I64(30), b"user:7".to_vec());
assert_eq!(c.key, b"user:7");Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.value: IndexValueLast value served.
let mut s = Segment::new();
for (k, v) in [(b"a", 1), (b"b", 2)] { s.apply(k, None, Some(IndexValue::I64(v))); }
let (_, next) = s.range(&IndexValue::I64(0), &IndexValue::I64(9), None, 1);
assert_eq!(next.expect("more to read").value, IndexValue::I64(1));key: Vec<u8>Last key served (tiebreak within a value).
let mut s = Segment::new();
for k in [b"x", b"y"] { s.apply(k, None, Some(IndexValue::I64(5))); }
let (_, next) = s.range(&IndexValue::I64(5), &IndexValue::I64(5), None, 1);
assert_eq!(next.expect("more to read").key, b"x", "ties break on the key");Implementations§
Trait Implementations§
impl Eq for Cursor
impl StructuralPartialEq for Cursor
Auto Trait Implementations§
impl Freeze for Cursor
impl RefUnwindSafe for Cursor
impl Send for Cursor
impl Sync for Cursor
impl Unpin for Cursor
impl UnsafeUnpin for Cursor
impl UnwindSafe for Cursor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more