Type Alias holochain::core::ActionHashed
pub type ActionHashed = HoloHashed<Action>;
Aliased Type§
struct ActionHashed {
pub content: Action,
pub hash: HoloHash<Action>,
}
Fields§
§content: Action
The content which is hashed of type C.
hash: HoloHash<Action>
The hash of the content C.
Implementations§
source§impl<C> HoloHashed<C>where
C: HashableContent,
impl<C> HoloHashed<C>where C: HashableContent,
sourcepub fn with_pre_hashed(
content: C,
hash: HoloHash<<C as HashableContent>::HashType>
) -> HoloHashed<C>
pub fn with_pre_hashed( content: C, hash: HoloHash<<C as HashableContent>::HashType> ) -> HoloHashed<C>
Combine content with its precalculated hash
sourcepub fn as_content(&self) -> &C
pub fn as_content(&self) -> &C
Accessor for content
sourcepub fn as_content_mut(&mut self) -> &mut C
pub fn as_content_mut(&mut self) -> &mut C
Mutable accessor for content. Only useful for heavily mocked/fixturated data in testing. Guaranteed the hash will no longer match the content if mutated.
sourcepub fn into_content(self) -> C
pub fn into_content(self) -> C
Convert to content
sourcepub fn into_inner(self) -> (C, HoloHash<<C as HashableContent>::HashType>)
pub fn into_inner(self) -> (C, HoloHash<<C as HashableContent>::HashType>)
Deconstruct as a tuple
source§impl<T, C> HoloHashed<C>where
T: HashTypeSync,
C: HashableContent<HashType = T>,
impl<T, C> HoloHashed<C>where T: HashTypeSync, C: HashableContent<HashType = T>,
sourcepub fn from_content_sync(content: C) -> HoloHashed<C>
pub fn from_content_sync(content: C) -> HoloHashed<C>
Compute the hash of this content and store it alongside
sourcepub fn verify_hash_sync(&self) -> Result<(), HoloHash<T>>
pub fn verify_hash_sync(&self) -> Result<(), HoloHash<T>>
Verify that the cached hash matches the content. Important to run this after e.g. deserialization.
source§impl<T, C> HoloHashed<C>where
T: HashTypeAsync,
C: HashableContent<HashType = T>,
impl<T, C> HoloHashed<C>where T: HashTypeAsync, C: HashableContent<HashType = T>,
sourcepub async fn from_content(content: C) -> impl Future<Output = HoloHashed<C>>
pub async fn from_content(content: C) -> impl Future<Output = HoloHashed<C>>
Compute the hash of this content and store it alongside
Trait Implementations§
source§impl<'a, C> Arbitrary<'a> for HoloHashed<C>where
C: HashableContent + Arbitrary<'a>,
<C as HashableContent>::HashType: PrimitiveHashType,
impl<'a, C> Arbitrary<'a> for HoloHashed<C>where C: HashableContent + Arbitrary<'a>, <C as HashableContent>::HashType: PrimitiveHashType,
source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<HoloHashed<C>, Error>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<HoloHashed<C>, Error>
Generate an arbitrary value of
Self
from the given unstructured data. Read more§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moresource§impl<C> AsRef<C> for HoloHashed<C>where
C: HashableContent,
impl<C> AsRef<C> for HoloHashed<C>where C: HashableContent,
source§impl<C> Borrow<C> for HoloHashed<C>where
C: HashableContent,
impl<C> Borrow<C> for HoloHashed<C>where C: HashableContent,
source§impl ChainItem for HoloHashed<Action>
impl ChainItem for HoloHashed<Action>
source§impl<C> Clone for HoloHashed<C>where
C: HashableContent + Clone,
impl<C> Clone for HoloHashed<C>where C: HashableContent + Clone,
source§fn clone(&self) -> HoloHashed<C>
fn clone(&self) -> HoloHashed<C>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<C> Debug for HoloHashed<C>where
C: Debug + HashableContent,
impl<C> Debug for HoloHashed<C>where C: Debug + HashableContent,
source§impl<C> Deref for HoloHashed<C>where
C: HashableContent,
impl<C> Deref for HoloHashed<C>where C: HashableContent,
source§impl<'de, C> Deserialize<'de> for HoloHashed<C>where
C: HashableContent + Deserialize<'de>,
impl<'de, C> Deserialize<'de> for HoloHashed<C>where C: HashableContent + Deserialize<'de>,
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<HoloHashed<C>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<HoloHashed<C>, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<T> From<SignedHashed<T>> for HoloHashed<T>where
T: HashableContent,
impl<T> From<SignedHashed<T>> for HoloHashed<T>where T: HashableContent,
§fn from(sh: SignedHashed<T>) -> HoloHashed<T>
fn from(sh: SignedHashed<T>) -> HoloHashed<T>
Converts to this type from the input type.
source§impl<C> HasHash<<C as HashableContent>::HashType> for HoloHashed<C>where
C: HashableContent,
impl<C> HasHash<<C as HashableContent>::HashType> for HoloHashed<C>where C: HashableContent,
source§impl<C> Hash for HoloHashed<C>where
C: HashableContent,
impl<C> Hash for HoloHashed<C>where C: HashableContent,
source§impl<C> HashableContent for HoloHashed<C>where
C: HashableContent,
impl<C> HashableContent for HoloHashed<C>where C: HashableContent,
§type HashType = <C as HashableContent>::HashType
type HashType = <C as HashableContent>::HashType
The HashType which this content will be hashed to
source§fn hash_type(&self) -> <HoloHashed<C> as HashableContent>::HashType
fn hash_type(&self) -> <HoloHashed<C> as HashableContent>::HashType
The HashType which this content will be hashed to
source§fn hashable_content(&self) -> HashableContentBytes
fn hashable_content(&self) -> HashableContentBytes
Return a subset of the content, either as SerializedBytes “content”,
which will be used to compute the hash, or as an already precomputed
hash which will be used directly
source§impl<C> Ord for HoloHashed<C>where
C: HashableContent + Ord,
impl<C> Ord for HoloHashed<C>where C: HashableContent + Ord,
source§fn cmp(&self, other: &HoloHashed<C>) -> Ordering
fn cmp(&self, other: &HoloHashed<C>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<C> PartialEq<HoloHashed<C>> for HoloHashed<C>where
C: HashableContent,
impl<C> PartialEq<HoloHashed<C>> for HoloHashed<C>where C: HashableContent,
source§fn eq(&self, other: &HoloHashed<C>) -> bool
fn eq(&self, other: &HoloHashed<C>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<C> PartialOrd<HoloHashed<C>> for HoloHashed<C>where
C: HashableContent + PartialOrd<C>,
impl<C> PartialOrd<HoloHashed<C>> for HoloHashed<C>where C: HashableContent + PartialOrd<C>,
source§fn partial_cmp(&self, other: &HoloHashed<C>) -> Option<Ordering>
fn partial_cmp(&self, other: &HoloHashed<C>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<C> Serialize for HoloHashed<C>where
C: HashableContent + Serialize,
impl<C> Serialize for HoloHashed<C>where C: HashableContent + Serialize,
source§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