Type Alias holochain_types::EntryHashed

pub type EntryHashed = HoloHashed<Entry>;
Expand description

An Entry paired with its EntryHash

Aliased Type§

struct EntryHashed {
    pub content: Entry,
    pub hash: HoloHash<Entry>,
}

Fields§

§content: Entry

The content which is hashed of type C.

§hash: HoloHash<Entry>

The hash of the content C.

Implementations§

source§

impl<C> HoloHashed<C>where C: HashableContent,

source

pub fn with_pre_hashed( content: C, hash: HoloHash<<C as HashableContent>::HashType> ) -> HoloHashed<C>

Combine content with its precalculated hash

source

pub fn as_content(&self) -> &C

Accessor for content

source

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.

source

pub fn into_content(self) -> C

Convert to content

source

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>,

source

pub fn from_content_sync(content: C) -> HoloHashed<C>

Compute the hash of this content and store it alongside

source

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>,

source

pub async fn from_content(content: C) -> impl Future<Output = HoloHashed<C>>

Compute the hash of this content and store it alongside

source

pub async fn verify_hash(&self) -> impl Future<Output = Result<(), HoloHash<T>>>

Verify that the cached hash matches the content. Important to run this after e.g. deserialization.

Trait Implementations§

source§

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>

Generate an arbitrary value of Self from the given unstructured data. Read more
source§

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 more
source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
source§

impl<C> AsRef<C> for HoloHashed<C>where C: HashableContent,

source§

fn as_ref(&self) -> &C

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<C> Borrow<C> for HoloHashed<C>where C: HashableContent,

source§

fn borrow(&self) -> &C

Immutably borrows from an owned value. Read more
source§

impl<C> Clone for HoloHashed<C>where C: HashableContent + Clone,

source§

fn clone(&self) -> HoloHashed<C>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<C> Debug for HoloHashed<C>where C: Debug + HashableContent,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<C> Deref for HoloHashed<C>where C: HashableContent,

§

type Target = C

The resulting type after dereferencing.
source§

fn deref(&self) -> &<HoloHashed<C> as Deref>::Target

Dereferences the value.
source§

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>,

Deserialize this value from the given Serde deserializer. Read more
§

impl<T> From<SignedHashed<T>> for HoloHashed<T>where T: HashableContent,

§

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,

source§

fn as_hash(&self) -> &HoloHash<<C as HashableContent>::HashType>

Get the hash by reference
source§

fn into_hash(self) -> HoloHash<<C as HashableContent>::HashType>

Convert to the owned hash
source§

impl<C> Hash for HoloHashed<C>where C: HashableContent,

source§

fn hash<StdH>(&self, state: &mut StdH)where StdH: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<C> HashableContent for HoloHashed<C>where C: HashableContent,

§

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

The HashType which this content will be hashed to
source§

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,

source§

fn cmp(&self, other: &HoloHashed<C>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<C> PartialEq<HoloHashed<C>> for HoloHashed<C>where C: HashableContent,

source§

fn eq(&self, other: &HoloHashed<C>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<C> PartialOrd<HoloHashed<C>> for HoloHashed<C>where C: HashableContent + PartialOrd<C>,

source§

fn partial_cmp(&self, other: &HoloHashed<C>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

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,

Serialize this value into the given Serde serializer. Read more
source§

impl<C> Eq for HoloHashed<C>where C: HashableContent,