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_action_hash(self) -> Option<HoloHash<Action>>
pub fn into_action_hash(self) -> Option<HoloHash<Action>>
If this hash represents a ActionHash, 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_action_hash(self) -> Option<HoloHash<Action>>
pub fn into_action_hash(self) -> Option<HoloHash<Action>>
If this hash represents a ActionHash, 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
sourcepub fn get_raw_32(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
pub fn get_raw_32(&self) -> &[u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Fetch just the core 32 bytes (without the 4 location bytes)
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,
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,
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>>
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>
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,
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>,
sourceimpl AgentPubKeyExt for HoloHash<Agent>
impl AgentPubKeyExt for HoloHash<Agent>
sourcefn into_kitsune(self) -> Arc<KitsuneAgent>
fn into_kitsune(self) -> Arc<KitsuneAgent>
sourcefn into_kitsune_raw(self) -> KitsuneAgent
fn into_kitsune_raw(self) -> KitsuneAgent
sourcefn from_kitsune(k: &Arc<KitsuneAgent>) -> HoloHash<Agent>
fn from_kitsune(k: &Arc<KitsuneAgent>) -> HoloHash<Agent>
sourcefn from_kitsune_raw(k: KitsuneAgent) -> HoloHash<Agent>
fn from_kitsune_raw(k: KitsuneAgent) -> HoloHash<Agent>
sourcefn to_kitsune(&self) -> Arc<KitsuneAgent>
fn to_kitsune(&self) -> Arc<KitsuneAgent>
sourceimpl AnyDhtHashExt for HoloHash<AnyDht>
impl AnyDhtHashExt for HoloHash<AnyDht>
sourcefn into_kitsune(self) -> Arc<KitsuneBasis>
fn into_kitsune(self) -> Arc<KitsuneBasis>
sourcefn into_kitsune_raw(self) -> KitsuneBasis
fn into_kitsune_raw(self) -> KitsuneBasis
sourcefn to_kitsune(&self) -> Arc<KitsuneBasis>
fn to_kitsune(&self) -> Arc<KitsuneBasis>
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>
Self
from the given unstructured data. Read morefn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self
from the entirety of the given
unstructured data. Read moresourceimpl<'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>
Self
from the given unstructured data. Read morefn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self
from the entirety of the given
unstructured data. Read moresourceimpl<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>,
sourceimpl DhtOpHashExt for HoloHash<DhtOp>
impl DhtOpHashExt for HoloHash<DhtOp>
sourcefn into_kitsune(self) -> Arc<KitsuneOpHash>
fn into_kitsune(self) -> Arc<KitsuneOpHash>
sourcefn into_kitsune_raw(self) -> KitsuneOpHash
fn into_kitsune_raw(self) -> KitsuneOpHash
sourcefn from_kitsune(k: &Arc<KitsuneOpHash>) -> HoloHash<DhtOp>
fn from_kitsune(k: &Arc<KitsuneOpHash>) -> HoloHash<DhtOp>
sourcefn from_kitsune_raw(k: KitsuneOpHash) -> HoloHash<DhtOp>
fn from_kitsune_raw(k: KitsuneOpHash) -> HoloHash<DhtOp>
sourcefn to_kitsune(&self) -> Arc<KitsuneOpHash>
fn to_kitsune(&self) -> Arc<KitsuneOpHash>
sourceimpl DnaHashExt for HoloHash<Dna>
impl DnaHashExt for HoloHash<Dna>
sourcefn into_kitsune(self) -> Arc<KitsuneSpace>
fn into_kitsune(self) -> Arc<KitsuneSpace>
sourcefn into_kitsune_raw(self) -> KitsuneSpace
fn into_kitsune_raw(self) -> KitsuneSpace
sourcefn from_kitsune(k: &Arc<KitsuneSpace>) -> HoloHash<Dna>
fn from_kitsune(k: &Arc<KitsuneSpace>) -> HoloHash<Dna>
sourcefn from_kitsune_raw(k: KitsuneSpace) -> HoloHash<Dna>
fn from_kitsune_raw(k: KitsuneSpace) -> HoloHash<Dna>
sourcefn to_kitsune(&self) -> Arc<KitsuneSpace>
fn to_kitsune(&self) -> Arc<KitsuneSpace>
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>
sourceimpl From<HoloHashB64<Action>> for HoloHash<AnyLinkable>
impl From<HoloHashB64<Action>> for HoloHash<AnyLinkable>
sourcefn from(h: HoloHashB64<Action>) -> HoloHash<AnyLinkable>
fn from(h: HoloHashB64<Action>) -> HoloHash<AnyLinkable>
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>
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>
sourceimpl From<TestChainHash> for HoloHash<Action>
impl From<TestChainHash> for HoloHash<Action>
sourcefn from(a: TestChainHash) -> HoloHash<Action>
fn from(a: TestChainHash) -> HoloHash<Action>
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>
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,
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl<T> PartialEq<HoloHash<T>> for HoloHash<T>where
T: PartialEq<T> + HashType,
impl<T> PartialEq<HoloHash<T>> for HoloHash<T>where
T: PartialEq<T> + 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>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresourceimpl<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,
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>
sourceimpl<T> TryFrom<&HoloHash<T>> for SerializedByteswhere
T: HashType,
impl<T> TryFrom<&HoloHash<T>> for SerializedByteswhere
T: HashType,
type Error = SerializedBytesError
type Error = SerializedBytesError
sourcefn try_from(t: &HoloHash<T>) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: &HoloHash<T>) -> Result<SerializedBytes, SerializedBytesError>
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
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
sourceimpl<T> TryFrom<HoloHash<T>> for SerializedByteswhere
T: HashType,
impl<T> TryFrom<HoloHash<T>> for SerializedByteswhere
T: HashType,
type Error = SerializedBytesError
type Error = SerializedBytesError
sourcefn try_from(t: HoloHash<T>) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(t: HoloHash<T>) -> Result<SerializedBytes, SerializedBytesError>
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
sourcefn try_from(sb: SerializedBytes) -> Result<HoloHash<T>, SerializedBytesError>
fn try_from(sb: SerializedBytes) -> Result<HoloHash<T>, SerializedBytesError>
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
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
impl<T> Any for Twhere
T: Any + ?Sized,
impl<T> Any for Twhere
T: Any + ?Sized,
fn type_id_compat(&self) -> TypeId
fn type_id_compat(&self) -> TypeId
impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read morefn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.