pub struct EventHash {
sha256: String,
}Expand description
Content hashes for a Matrix event.
The Matrix spec currently defines only one hash algorithm (sha256).
Represented in PDUs as {"sha256": "<base64-encoded-hash>"}.
Fields§
§sha256: StringSHA-256 content hash, base64-encoded without padding.
Implementations§
Source§impl EventHash
impl EventHash
Sourcepub fn new(sha256: impl Into<String>) -> Self
pub fn new(sha256: impl Into<String>) -> Self
Creates a new EventHash with the given SHA-256 hash string.
Sourcepub fn to_json_value(&self) -> Value
pub fn to_json_value(&self) -> Value
Serializes this hash to a serde_json::Value.
This is infallible because the struct contains only a String field,
which serde_json can always represent.
Sourcepub fn to_canonical_json_value(&self) -> CanonicalJsonValue
pub fn to_canonical_json_value(&self) -> CanonicalJsonValue
Serializes this hash to a [canonical_json::CanonicalJsonValue].
Wrapper around EventHash::to_json_value, which does an infallible conversion to the
canonical version.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for EventHash
impl<'de> Deserialize<'de> for EventHash
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for EventHash
impl StructuralPartialEq for EventHash
Auto Trait Implementations§
impl Freeze for EventHash
impl RefUnwindSafe for EventHash
impl Send for EventHash
impl Sync for EventHash
impl Unpin for EventHash
impl UnsafeUnpin for EventHash
impl UnwindSafe for EventHash
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
Mutably borrows from an owned value. Read more
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>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§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 Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.