Struct holochain_types::dna::HoloHash
source · [−]pub struct HoloHash<T> where
T: HashType, { /* private fields */ }
Expand description
A HoloHash contains a vector of 36 bytes representing a 32-byte blake2b hash plus 4 bytes representing a DHT location. It also contains a zero-sized type which specifies what it is a hash of.
There is custom de/serialization implemented in [ser.rs]
Implementations
sourceimpl HoloHash<AnyLinkable>
impl HoloHash<AnyLinkable>
sourcepub fn into_primitive(self) -> AnyLinkableHashPrimitive
pub fn into_primitive(self) -> AnyLinkableHashPrimitive
Match on the primitive hash type represented by this composite hash type
sourcepub fn into_entry_hash(self) -> Option<HoloHash<Entry>>
pub fn into_entry_hash(self) -> Option<HoloHash<Entry>>
If this hash represents an EntryHash, return it, else None
sourcepub fn into_header_hash(self) -> Option<HoloHash<Header>>
pub fn into_header_hash(self) -> Option<HoloHash<Header>>
If this hash represents a HeaderHash, return it, else None
sourcepub fn into_external_hash(self) -> Option<HoloHash<External>>
pub fn into_external_hash(self) -> Option<HoloHash<External>>
If this hash represents an ExternalHash, return it, else None
sourceimpl HoloHash<AnyDht>
impl HoloHash<AnyDht>
sourcepub fn into_primitive(self) -> AnyDhtHashPrimitive
pub fn into_primitive(self) -> AnyDhtHashPrimitive
Match on the primitive hash type represented by this composite hash type
sourcepub fn into_entry_hash(self) -> Option<HoloHash<Entry>>
pub fn into_entry_hash(self) -> Option<HoloHash<Entry>>
If this hash represents an EntryHash, return it, else None
sourcepub fn into_header_hash(self) -> Option<HoloHash<Header>>
pub fn into_header_hash(self) -> Option<HoloHash<Header>>
If this hash represents a HeaderHash, return it, else None
sourceimpl<T> HoloHash<T> where
T: HashType,
impl<T> HoloHash<T> where
T: HashType,
sourcepub fn from_raw_39(hash: Vec<u8, Global>) -> Result<HoloHash<T>, HoloHashError>
pub fn from_raw_39(hash: Vec<u8, Global>) -> Result<HoloHash<T>, HoloHashError>
Raw constructor: Create a HoloHash from 39 bytes, using the prefix bytes to determine the hash_type
sourcepub fn from_raw_39_panicky(hash: Vec<u8, Global>) -> HoloHash<T>
pub fn from_raw_39_panicky(hash: Vec<u8, Global>) -> HoloHash<T>
Raw constructor: Create a HoloHash from 39 bytes, using the prefix bytes to determine the hash_type. Panics if hash_type does not match.
sourcepub fn from_raw_36_and_type(bytes: Vec<u8, Global>, hash_type: T) -> HoloHash<T>
pub fn from_raw_36_and_type(bytes: Vec<u8, Global>, hash_type: T) -> HoloHash<T>
Use a precomputed hash + location byte array in vec form, along with a type, to construct a hash. Used in this crate only, for testing.
sourcepub fn retype<TT>(self, hash_type: TT) -> HoloHash<TT> where
TT: HashType,
pub fn retype<TT>(self, hash_type: TT) -> HoloHash<TT> where
TT: HashType,
Change the type of this HoloHash, keeping the same bytes
sourcepub fn get_raw_39(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn get_raw_39(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Get the raw 39-byte Vec including the 3 byte prefix, base 32 bytes, and the 4 byte loc
sourcepub fn get_raw_36(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn get_raw_36(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Get 36-byte Vec which excludes the 3 byte prefix
sourceimpl<T> HoloHash<T> where
T: HashType,
impl<T> HoloHash<T> where
T: HashType,
sourcepub fn from_raw_32_and_type(hash: Vec<u8, Global>, hash_type: T) -> HoloHash<T>
pub fn from_raw_32_and_type(hash: Vec<u8, Global>, hash_type: T) -> HoloHash<T>
Construct a HoloHash from a 32-byte hash. The 3 prefix bytes will be added based on the provided HashType, and the 4 location bytes will be computed.
For convenience, 36 bytes can also be passed in, in which case the location bytes will used as provided, not computed.
sourceimpl<P> HoloHash<P> where
P: PrimitiveHashType,
impl<P> HoloHash<P> where
P: PrimitiveHashType,
sourceimpl<T> HoloHash<T> where
T: HashTypeSync,
impl<T> HoloHash<T> where
T: HashTypeSync,
sourcepub fn with_data_sync<C>(content: &C) -> HoloHash<T> where
C: HashableContent<HashType = T>,
pub fn with_data_sync<C>(content: &C) -> HoloHash<T> where
C: HashableContent<HashType = T>,
Synchronously hash a reference to the given content to produce a HoloHash If the content is larger than MAX_HASHABLE_CONTENT_LEN, this will panic!
sourceimpl<T> HoloHash<T> where
T: HashTypeAsync,
impl<T> HoloHash<T> where
T: HashTypeAsync,
sourcepub async fn with_data<C>(content: &'_ C) -> HoloHash<T> where
C: HashableContent<HashType = T>,
pub async fn with_data<C>(content: &'_ C) -> HoloHash<T> where
C: HashableContent<HashType = T>,
Asynchronously hash a reference to the given content to produce a HoloHash
Trait Implementations
sourceimpl AgentPubKeyExt for HoloHash<Agent>
impl AgentPubKeyExt for HoloHash<Agent>
sourcefn new_random(
keystore: &MetaLairClient
) -> MustBoxFuture<'static, Result<HoloHash<Agent>, OneErr>> where
HoloHash<Agent>: Sized,
fn new_random(
keystore: &MetaLairClient
) -> MustBoxFuture<'static, Result<HoloHash<Agent>, OneErr>> where
HoloHash<Agent>: Sized,
create a new agent keypair in given keystore, returning the AgentPubKey
sourcefn sign_raw(
&self,
keystore: &MetaLairClient,
data: Arc<[u8]>
) -> MustBoxFuture<'static, Result<Signature, OneErr>>
fn sign_raw(
&self,
keystore: &MetaLairClient,
data: Arc<[u8]>
) -> MustBoxFuture<'static, Result<Signature, OneErr>>
sign some arbitrary raw bytes
sourcefn verify_signature_raw(
&self,
signature: &Signature,
data: Arc<[u8]>
) -> MustBoxFuture<'static, bool>
fn verify_signature_raw(
&self,
signature: &Signature,
data: Arc<[u8]>
) -> MustBoxFuture<'static, bool>
verify a signature for given raw bytes with this agent public_key is valid
sourcefn sign<S>(
&self,
keystore: &MetaLairClient,
input: S
) -> MustBoxFuture<'static, Result<Signature, OneErr>> where
S: Serialize + Debug,
fn sign<S>(
&self,
keystore: &MetaLairClient,
input: S
) -> MustBoxFuture<'static, Result<Signature, OneErr>> where
S: Serialize + Debug,
sign some arbitrary data
sourcefn verify_signature<D>(
&self,
signature: &Signature,
data: D
) -> MustBoxFuture<'static, bool> where
D: TryInto<SerializedBytes, Error = SerializedBytesError>,
fn verify_signature<D>(
&self,
signature: &Signature,
data: D
) -> MustBoxFuture<'static, bool> where
D: TryInto<SerializedBytes, Error = SerializedBytesError>,
verify a signature for given data with this agent public_key is valid
sourceimpl<'a> Arbitrary<'a> for HoloHash<AnyLinkable>
impl<'a> Arbitrary<'a> for HoloHash<AnyLinkable>
sourcefn arbitrary(u: &mut Unstructured<'a>) -> Result<HoloHash<AnyLinkable>, Error>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<HoloHash<AnyLinkable>, Error>
Generate an arbitrary value of Self
from the given unstructured data. Read more
sourcefn 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 more
sourceimpl<'a, P> Arbitrary<'a> for HoloHash<P> where
P: PrimitiveHashType,
impl<'a, P> Arbitrary<'a> for HoloHash<P> where
P: PrimitiveHashType,
sourcefn arbitrary(u: &mut Unstructured<'a>) -> Result<HoloHash<P>, Error>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<HoloHash<P>, Error>
Generate an arbitrary value of Self
from the given unstructured data. Read more
sourcefn 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 more
impl AsRef<HoloHash<Agent>> for VerifySignature
impl AsRef<HoloHash<Agent>> for VerifySignature
sourceimpl<T> AsRef<HoloHash<T>> for HoloHashB64<T> where
T: HashType,
impl<T> AsRef<HoloHash<T>> for HoloHashB64<T> where
T: HashType,
sourceimpl<'de, T> Deserialize<'de> for HoloHash<T> where
T: HashType,
impl<'de, T> Deserialize<'de> for HoloHash<T> where
T: HashType,
sourcefn deserialize<D>(
deserializer: D
) -> Result<HoloHash<T>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<HoloHash<T>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<HoloHash<Header>> for DeleteInput
impl From<HoloHash<Header>> for DeleteInput
sourcefn from(deletes_header_hash: HoloHash<Header>) -> DeleteInput
fn from(deletes_header_hash: HoloHash<Header>) -> DeleteInput
Sets ChainTopOrdering
to default
= Strict
when created from a hash.
sourceimpl From<HoloHash<Header>> for TimedHeaderHash
impl From<HoloHash<Header>> for TimedHeaderHash
sourcefn from(h: HeaderHash) -> Self
fn from(h: HeaderHash) -> Self
Converts to this type from the input type.
sourceimpl<T> From<HoloHash<T>> for HoloHashB64<T> where
T: HashType,
impl<T> From<HoloHash<T>> for HoloHashB64<T> where
T: HashType,
sourcefn from(original: HoloHash<T>) -> HoloHashB64<T>
fn from(original: HoloHash<T>) -> HoloHashB64<T>
Converts to this type from the input type.
sourceimpl From<HoloHashB64<Entry>> for HoloHash<AnyLinkable>
impl From<HoloHashB64<Entry>> for HoloHash<AnyLinkable>
sourcefn from(h: HoloHashB64<Entry>) -> HoloHash<AnyLinkable>
fn from(h: HoloHashB64<Entry>) -> HoloHash<AnyLinkable>
Converts to this type from the input type.
sourceimpl From<HoloHashB64<Header>> for HoloHash<AnyLinkable>
impl From<HoloHashB64<Header>> for HoloHash<AnyLinkable>
sourcefn from(h: HoloHashB64<Header>) -> HoloHash<AnyLinkable>
fn from(h: HoloHashB64<Header>) -> HoloHash<AnyLinkable>
Converts to this type from the input type.
sourceimpl<T> From<HoloHashB64<T>> for HoloHash<T> where
T: HashType,
impl<T> From<HoloHashB64<T>> for HoloHash<T> where
T: HashType,
sourcefn from(original: HoloHashB64<T>) -> HoloHash<T>
fn from(original: HoloHashB64<T>) -> HoloHash<T>
Converts to this type from the input type.
sourceimpl<T> FromSql for HoloHash<T> where
T: HashType,
impl<T> FromSql for HoloHash<T> where
T: HashType,
sourcefn column_result(value: ValueRef<'_>) -> Result<HoloHash<T>, FromSqlError>
fn column_result(value: ValueRef<'_>) -> Result<HoloHash<T>, FromSqlError>
Converts SQLite value into Rust value.
sourceimpl<T> IntoIterator for HoloHash<T> where
T: HashType,
impl<T> IntoIterator for HoloHash<T> where
T: HashType,
sourceimpl<T> Ord for HoloHash<T> where
T: Ord + HashType,
impl<T> Ord for HoloHash<T> where
T: Ord + HashType,
sourceimpl<T> PartialOrd<HoloHash<T>> for HoloHash<T> where
T: PartialOrd<T> + HashType,
impl<T> PartialOrd<HoloHash<T>> for HoloHash<T> where
T: PartialOrd<T> + HashType,
sourcefn partial_cmp(&self, other: &HoloHash<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &HoloHash<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<T> Serialize for HoloHash<T> where
T: HashType,
impl<T> Serialize for HoloHash<T> where
T: HashType,
sourcefn 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
sourceimpl<T> ToSql for HoloHash<T> where
T: HashType,
impl<T> ToSql for HoloHash<T> where
T: HashType,
sourcefn to_sql(&self) -> Result<ToSqlOutput<'_>, Error>
fn to_sql(&self) -> Result<ToSqlOutput<'_>, Error>
Converts Rust value to SQLite value
sourceimpl<'_, T> TryFrom<&'_ HoloHash<T>> for SerializedBytes where
T: HashType,
impl<'_, T> TryFrom<&'_ HoloHash<T>> for SerializedBytes where
T: HashType,
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
sourcefn try_from(t: &HoloHash<T>) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: &HoloHash<T>) -> Result<SerializedBytes, SerializedBytesError>
Performs the conversion.
sourceimpl<'_, P> TryFrom<&'_ String> for HoloHash<P> where
P: PrimitiveHashType,
impl<'_, P> TryFrom<&'_ String> for HoloHash<P> where
P: PrimitiveHashType,
type Error = HoloHashError
type Error = HoloHashError
The type returned in the event of a conversion error.
sourceimpl<'_, P> TryFrom<&'_ str> for HoloHash<P> where
P: PrimitiveHashType,
impl<'_, P> TryFrom<&'_ str> for HoloHash<P> where
P: PrimitiveHashType,
type Error = HoloHashError
type Error = HoloHashError
The type returned in the event of a conversion error.
sourceimpl<T> TryFrom<HoloHash<T>> for SerializedBytes where
T: HashType,
impl<T> TryFrom<HoloHash<T>> for SerializedBytes where
T: HashType,
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
sourcefn try_from(t: HoloHash<T>) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: HoloHash<T>) -> Result<SerializedBytes, SerializedBytesError>
Performs the conversion.
sourceimpl<T> TryFrom<SerializedBytes> for HoloHash<T> where
T: HashType,
impl<T> TryFrom<SerializedBytes> for HoloHash<T> where
T: HashType,
type Error = SerializedBytesError
type Error = SerializedBytesError
The type returned in the event of a conversion error.
sourcefn try_from(sb: SerializedBytes) -> Result<HoloHash<T>, SerializedBytesError>
fn try_from(sb: SerializedBytes) -> Result<HoloHash<T>, SerializedBytesError>
Performs the conversion.
sourceimpl<P> TryFrom<String> for HoloHash<P> where
P: PrimitiveHashType,
impl<P> TryFrom<String> for HoloHash<P> where
P: PrimitiveHashType,
type Error = HoloHashError
type Error = HoloHashError
The type returned in the event of a conversion error.
impl<T> Eq for HoloHash<T> where
T: Eq + HashType,
impl<T> StructuralEq for HoloHash<T> where
T: HashType,
impl<T> StructuralPartialEq for HoloHash<T> where
T: HashType,
Auto Trait Implementations
impl<T> RefUnwindSafe for HoloHash<T> where
T: RefUnwindSafe,
impl<T> Send for HoloHash<T> where
T: Send,
impl<T> Sync for HoloHash<T> where
T: Sync,
impl<T> Unpin for HoloHash<T> where
T: Unpin,
impl<T> UnwindSafe for HoloHash<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
impl<T> FutureExt for T
impl<T> FutureExt for T
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more