Struct couchdb::Revision
[−]
[src]
pub struct Revision { /* fields omitted */ }
Revision
contains a document revision.
Summary
Revision
stores a revision, which is a string that looks like1-9c65296036141e575d32ba9c034dd3ee
.Revision
can be parsed from a string viaFromStr
or theRevision::parse
method.Revision
implementsDeserialize
andSerialize
.
Remarks
A CouchDB document revision comprises a sequence number and an MD5
digest. The sequence number (usually) starts at 1
when the document is
created and increments by one each time the document is updated. The digest
is a hash of the document content, which the CouchDB server uses to detect
conflicts.
Example
extern crate couchdb; let rev = couchdb::Revision::parse("42-1234567890abcdef1234567890abcdef") .unwrap(); assert_eq!(rev.to_string(), "42-1234567890abcdef1234567890abcdef");
Methods
impl Revision
[src]
fn parse(s: &str) -> Result<Self, Error>
Constructs a new Revision
from the given string.
The string must be of the form 42-1234567890abcdef1234567890abcdef
.
fn sequence_number(&self) -> u64
Returns the sequence number part of the revision.
The sequence number is the 42
part of the revision
42-1234567890abcdef1234567890abcdef
.
Trait Implementations
impl Clone for Revision
[src]
fn clone(&self) -> Revision
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Revision
[src]
impl Eq for Revision
[src]
impl Hash for Revision
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq for Revision
[src]
fn eq(&self, __arg_0: &Revision) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Revision) -> bool
This method tests for !=
.
impl Display for Revision
[src]
impl FromStr for Revision
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses a string s
to return a value of this type. Read more
impl Serialize for Revision
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'de> Deserialize<'de> for Revision
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more