#[non_exhaustive]pub struct DecodedFrame {
pub offset: u64,
pub argv: Argv,
}Expand description
A decoded mutation frame the replica should apply to its local
store. Ownership of the Argv passes to the caller.
use kevy_replicate::replica::DecodedFrame;
use kevy_replicate::wire::{decode_frame, encode_frame};
let argv = kevy_resp::Argv::from(vec![b"SET".to_vec(), b"k".to_vec(), b"v".to_vec()]);
let (frame, _) = decode_frame(&encode_frame(3, &argv))?;
assert_eq!(frame, DecodedFrame::new(3, argv));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: u64Monotonic offset the primary assigned at apply-time.
use kevy_replicate::wire::{decode_frame, encode_frame};
let ping = kevy_resp::Argv::from(vec![b"PING".to_vec()]);
let (frame, _) = decode_frame(&encode_frame(41, &ping))?;
assert_eq!(frame.offset, 41);argv: ArgvWire-decoded argv — feed to the dispatcher the same way AOF replay does (cmd name + arg bytes).
use kevy_replicate::wire::{decode_frame, encode_frame};
let del = kevy_resp::Argv::from(vec![b"DEL".to_vec(), b"k".to_vec()]);
let (frame, _) = decode_frame(&encode_frame(0, &del))?;
assert_eq!(frame.argv.first(), Some(&b"DEL"[..]));
assert_eq!(frame.argv.get(1), Some(&b"k"[..]));Implementations§
Trait Implementations§
Source§impl Clone for DecodedFrame
impl Clone for DecodedFrame
Source§impl Debug for DecodedFrame
impl Debug for DecodedFrame
impl Eq for DecodedFrame
Source§impl Hash for DecodedFrame
impl Hash for DecodedFrame
Source§impl PartialEq for DecodedFrame
impl PartialEq for DecodedFrame
impl StructuralPartialEq for DecodedFrame
Auto Trait Implementations§
impl Freeze for DecodedFrame
impl RefUnwindSafe for DecodedFrame
impl Send for DecodedFrame
impl Sync for DecodedFrame
impl Unpin for DecodedFrame
impl UnsafeUnpin for DecodedFrame
impl UnwindSafe for DecodedFrame
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