You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CouchDB revisions comprise a number followed by a hash value. A revision with a smaller number is less than a revision with a bigger number.
However, the Revision type compares the number parts lexicographically. E.g., 7 should be less than 13, but the Revision type orders 13 before 7 because the character '1' is less than the character '7'.
The following program demonstrates the problem by failing the assertion:
let r1 = couchdb::Revision::from("7-12345678123456781234567812345678");
let r2 = couchdb::Revision::from("13-12345678123456781234567812345678");
assert!(r1 < r2);
The text was updated successfully, but these errors were encountered:
As of v0.3.x, the API exposed by the Revision type is fundamentally flawed. The type thinly wraps a String by implementing traits such as AsRef<&str>, From<String>, etc., but, conceptually, the Revision type should instead wrap a tuple comprising the number part (of u64 type) and the hash part (of a string or binary type). So, for example, the type should not implement the AsRef<&str> or From<String> traits but should instead implement std::str::FromStr.
CouchDB revisions comprise a number followed by a hash value. A revision with a smaller number is less than a revision with a bigger number.
However, the
Revision
type compares the number parts lexicographically. E.g.,7
should be less than13
, but theRevision
type orders13
before7
because the character'1'
is less than the character'7'
.The following program demonstrates the problem by failing the assertion:
The text was updated successfully, but these errors were encountered: