pub struct Revision {
pub id: u32,
pub sha256: [u8; 32],
}
Expand description
Information about a Document
’s revision history.
Fields§
§id: u32
The current revision id of the document. This value is sequentially incremented on each document update.
sha256: [u8; 32]
The SHA256 digest of the bytes contained within the Document
.
Implementations§
§impl Revision
impl Revision
pub fn new(contents: &[u8]) -> Revision
pub fn new(contents: &[u8]) -> Revision
Creates the first revision for a document with the SHA256 digest of the passed bytes.
pub fn with_id(id: u32, contents: &[u8]) -> Revision
pub fn with_id(id: u32, contents: &[u8]) -> Revision
Creates a revision with id
for a document with the SHA256 digest of the passed bytes.
pub fn next_revision(&self, new_contents: &[u8]) -> Option<Revision>
pub fn next_revision(&self, new_contents: &[u8]) -> Option<Revision>
Creates the next revision in sequence with an updated digest. If the digest doesn’t change, None is returned.
Panics
Panics if id
overflows.
Trait Implementations§
§impl<'de> Deserialize<'de> for Revision
impl<'de> Deserialize<'de> for Revision
§fn deserialize<__D>(
__deserializer: __D
) -> Result<Revision, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<Revision, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Serialize for Revision
impl Serialize for Revision
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Revision
impl Eq for Revision
impl StructuralEq for Revision
impl StructuralPartialEq for Revision
Auto Trait Implementations§
impl RefUnwindSafe for Revision
impl Send for Revision
impl Sync for Revision
impl Unpin for Revision
impl UnwindSafe for Revision
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.