pub struct Update { /* private fields */ }Expand description
An ordered list of field operations.
use tarant::Update;
let ops = Update::new()
.set(2, "ann") // field 2 = "ann"
.add(3, 1) // field 3 += 1
.delete(4, 1); // remove one field starting at 4
assert_eq!(ops.len(), 3);Operations are encoded as they are added; an argument that cannot be serialised is reported by the request that carries the update.
Implementations§
Source§impl Update
impl Update
Sourcepub fn set(self, field: impl Into<FieldRef>, value: impl Serialize) -> Self
pub fn set(self, field: impl Into<FieldRef>, value: impl Serialize) -> Self
=: assign value to field, extending the tuple if it is the next field.
Sourcepub fn add(self, field: impl Into<FieldRef>, delta: impl Serialize) -> Self
pub fn add(self, field: impl Into<FieldRef>, delta: impl Serialize) -> Self
+: add delta to a numeric field.
Sourcepub fn sub(self, field: impl Into<FieldRef>, delta: impl Serialize) -> Self
pub fn sub(self, field: impl Into<FieldRef>, delta: impl Serialize) -> Self
-: subtract delta from a numeric field.
Sourcepub fn bit_and(self, field: impl Into<FieldRef>, mask: u64) -> Self
pub fn bit_and(self, field: impl Into<FieldRef>, mask: u64) -> Self
&: bitwise AND with mask on an unsigned field.
Sourcepub fn bit_or(self, field: impl Into<FieldRef>, mask: u64) -> Self
pub fn bit_or(self, field: impl Into<FieldRef>, mask: u64) -> Self
|: bitwise OR with mask on an unsigned field.
Sourcepub fn bit_xor(self, field: impl Into<FieldRef>, mask: u64) -> Self
pub fn bit_xor(self, field: impl Into<FieldRef>, mask: u64) -> Self
^: bitwise XOR with mask on an unsigned field.
Sourcepub fn insert(self, field: impl Into<FieldRef>, value: impl Serialize) -> Self
pub fn insert(self, field: impl Into<FieldRef>, value: impl Serialize) -> Self
!: insert value before field, shifting the rest right.
Sourcepub fn delete(self, field: impl Into<FieldRef>, count: u32) -> Self
pub fn delete(self, field: impl Into<FieldRef>, count: u32) -> Self
#: delete count fields starting at field.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Update
impl RefUnwindSafe for Update
impl Send for Update
impl Sync for Update
impl Unpin for Update
impl UnsafeUnpin for Update
impl UnwindSafe for Update
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