pub struct Revision {
pub patch: Patch,
pub duplicates: Vec<(String, String)>,
pub resulting_data_hash: Sha256Hex,
}Expand description
A commit on a governance entry: an RFC 6902 patch from its previous version to the next.
Nothing is overwritten. The entry keeps the data it was signed with,
and its latest version is derived by applying every revision’s
patch in chain order, as git derives a checkout from its commits. See
AmendmentDraft::revision.
A value a patch adds (add, replace, test) lives in the amendment,
which redaction cannot reach yet; removals, moves and copies carry no
content.
Fields§
§patch: PatchFrom the previous version to this one
duplicates: Vec<(String, String)>For each remove of a duplicate, the removed path and the path it
duplicated: what a later redaction of the one must also erase from
the stored original. Not test ops, which would carry the values.
resulting_data_hash: Sha256HexWhat the entry’s data hashes to after patch
Implementations§
Source§impl Revision
impl Revision
Sourcepub fn validate(&self) -> Result<(), ReviseError>
pub fn validate(&self) -> Result<(), ReviseError>
Everything wrong with it that is checkable without data: an empty
patch, or a duplicate the patch does not remove
Sourcepub fn remove_duplicates(
data: &Value,
pairs: &[(&str, &str)],
) -> Result<Edit, ReviseError>
pub fn remove_duplicates( data: &Value, pairs: &[(&str, &str)], ) -> Result<Edit, ReviseError>
An Edit removing each (path, same_as) pair’s path, whose
value is byte-identical (as canonical_json) to same_as’s,
which it leaves in place
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Revision
impl<'de> Deserialize<'de> for Revision
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Revision
impl StructuralPartialEq for Revision
Auto Trait Implementations§
impl Freeze for Revision
impl RefUnwindSafe for Revision
impl Send for Revision
impl Sync for Revision
impl Unpin for Revision
impl UnsafeUnpin for Revision
impl UnwindSafe for Revision
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.