Skip to main content

Change

Struct Change 

Source
#[non_exhaustive]
pub struct Change { pub path: Arc<str>, pub old_value: OwnedDataValue, pub new_value: OwnedDataValue, pub removed: bool, pub replaced: bool, /* private fields */ }
Expand description

One write or removal, written as v3 wrote one.

A path that was absent before the write records old_value as null.

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.
§path: Arc<str>

The dotted path written.

§old_value: OwnedDataValue

What the path held before; null when it was absent.

§new_value: OwnedDataValue

The value written; null for a removal (read removed to tell a removal from a write of null).

§removed: bool

The key at path was removed rather than written. Absent when false, so a write’s JSON is v3’s.

§replaced: bool

The write replaced the root at path instead of merging into it: a host function’s write at a root replaces it, and map’s root mapping, which records only the keys it wrote, merges. A trace’s changes carry it, so a replay knows which; an audit entry’s are always false, so the audit trail’s JSON is v3’s. Absent when false.

Implementations§

Source§

impl Change

Source

pub fn write( path: impl Into<Arc<str>>, old_value: OwnedDataValue, new_value: OwnedDataValue, ) -> Self

A write of new_value over old_value at path.

Source

pub fn removal(path: impl Into<Arc<str>>, old_value: OwnedDataValue) -> Self

A removal of the key at path, which held old_value.

Trait Implementations§

Source§

impl Clone for Change

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Change

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

The wire fields, as a derive would show them; every field named, as in eq.

Source§

impl<'de> Deserialize<'de> for Change

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Change

Source§

fn eq(&self, other: &Self) -> bool

The wire fields; not whether the change is the trace’s alone. The destructuring names every field, so a field added later does not compile until it is compared or deliberately left out.

1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Change

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.