#[non_exhaustive]pub struct Change {
pub offset: u64,
pub argv: Vec<Vec<u8>>,
}Expand description
One mutation delivered by Store::changes_since.
use kevy_embedded::{Config, Store};
let store = Store::open(Config::default().with_feed(0))?;
let from = store.changes_tail()?;
store.set(b"k", b"v")?;
let batch = store.changes_since(from, 10, &[])?;
let change = &batch.changes[0];
assert_eq!(change.offset, from.offset);
assert_eq!(change.argv[0], b"SET");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.offset: u64Stream offset (monotonic within a generation).
use kevy_embedded::{Config, Store};
let store = Store::open(Config::default().with_feed(0))?;
let from = store.changes_tail()?;
store.set(b"a", b"1")?;
store.set(b"b", b"2")?;
let offsets: Vec<u64> = store.changes_since(from, 10, &[])?.changes.iter().map(|c| c.offset).collect();
assert_eq!(offsets, [from.offset, from.offset + 1]);argv: Vec<Vec<u8>>The applied effect’s argv (same frames the AOF / a replica sees).
use kevy_embedded::{Config, Store};
let store = Store::open(Config::default().with_feed(0))?;
let from = store.changes_tail()?;
store.hset(b"h", &[(b"f", b"v")])?;
let argv = &store.changes_since(from, 10, &[])?.changes[0].argv;
assert_eq!(argv, &[b"HSET".to_vec(), b"h".to_vec(), b"f".to_vec(), b"v".to_vec()]);Implementations§
Source§impl Change
impl Change
Sourcepub fn new(offset: u64, argv: Vec<Vec<u8>>) -> Self
pub fn new(offset: u64, argv: Vec<Vec<u8>>) -> Self
A change at offset carrying argv — what a client decoding a
server’s FEED.READ reply builds, so both backends hand back
the same type.
let c = kevy_embedded::Change::new(7, vec![b"DEL".to_vec(), b"k".to_vec()]);
assert_eq!((c.offset, c.argv.len()), (7, 2));Trait Implementations§
impl Eq for Change
impl StructuralPartialEq for Change
Auto Trait Implementations§
impl Freeze for Change
impl RefUnwindSafe for Change
impl Send for Change
impl Sync for Change
impl Unpin for Change
impl UnsafeUnpin for Change
impl UnwindSafe for Change
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