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<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<P> HoloHash<P> where
P: PrimitiveHashType,
impl<P> HoloHash<P> where
P: PrimitiveHashType,
Trait Implementations
impl AsRef<HoloHash<Agent>> for VerifySignature
impl AsRef<HoloHash<Agent>> for VerifySignature
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<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> 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<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.
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.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
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
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more