pub struct Content(/* private fields */);Expand description
A put’s document, as a target compares two (§2.7): the SHA-256 of its canonical form for a payload encoded as JSON that reads as strict JSON, else of its bytes. Equal digests are the same document.
The canonical form is JCS’s (RFC 8785), members in order and nothing
but the value, with one change (text 0.2, F-166): a number is written
by its exact value, never as the double RFC 8785 reads, so 10, 10.0
and 1e1 are one document and 2^53 and 2^53 + 1 are two. Its bytes are
strict JSON, a number spelled as exact_number writes it, so they are
their own canonical form, and never the bytes of a payload that does
not read.
Implementations§
Source§impl Content
impl Content
Sourcepub fn of_json(v: &Value) -> Self
pub fn of_json(v: &Value) -> Self
A decoded JSON document, compared by its canonical form. A
serde_json float is a double, so it compares as the double’s
shortest spelling; an integer within 64 bits is exact. A runtime
compares a payload’s bytes (Content::of_payload), whose every
number is exact.
Sourcepub fn of_payload(bytes: &[u8], json: bool) -> Self
pub fn of_payload(bytes: &[u8], json: bool) -> Self
A payload as a target compares it (§2.7): one encoded as JSON
(json) by its canonical form when it reads as strict JSON (§2.10’s
reading, strict_json: every number finite by rounding, at most
MAX_DEPTH deep), and every other payload, or JSON that does not
read, byte for byte.
Trait Implementations§
impl Copy for Content
impl Eq for Content
impl StructuralPartialEq for Content
Auto Trait Implementations§
impl Forget for Content
impl Freeze for Content
impl Move for Content
impl RefUnwindSafe for Content
impl Send for Content
impl Sync for Content
impl Unpin for Content
impl UnsafeUnpin for Content
impl UnwindSafe for Content
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more