Struct hdk::prelude::HoloHash [−][src]
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
impl<T> HoloHash<T> where
T: HashType,
[src]
T: HashType,
pub fn from_raw_39(hash: Vec<u8, Global>) -> Result<HoloHash<T>, HoloHashError>
[src]
Raw constructor: Create a HoloHash from 39 bytes, using the prefix bytes to determine the hash_type
pub fn from_raw_39_panicky(hash: Vec<u8, Global>) -> HoloHash<T>
[src]
Raw constructor: Create a HoloHash from 39 bytes, using the prefix bytes to determine the hash_type. Panics if hash_type does not match.
pub fn from_raw_36_and_type(bytes: Vec<u8, Global>, hash_type: T) -> HoloHash<T>
[src]
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.
pub fn retype<TT>(self, hash_type: TT) -> HoloHash<TT> where
TT: HashType,
[src]
TT: HashType,
Change the type of this HoloHash, keeping the same bytes
pub fn hash_type(&self) -> &T
[src]
The HashType of this hash
pub fn get_raw_39(&self) -> &[u8]ⓘ
[src]
Get the raw 39-byte Vec including the 3 byte prefix, base 32 bytes, and the 4 byte loc
pub fn get_raw_36(&self) -> &[u8]ⓘ
[src]
Get 36-byte Vec which excludes the 3 byte prefix
pub fn get_raw_32(&self) -> &[u8]ⓘ
[src]
Fetch just the core 32 bytes (without the 4 location bytes)
pub fn get_loc(&self) -> u32
[src]
Fetch the holo dht location for this hash
pub fn into_inner(self) -> Vec<u8, Global>ⓘ
[src]
consume into the inner byte vector
impl<T> HoloHash<T> where
T: HashType,
[src]
T: HashType,
pub fn from_raw_32_and_type(hash: Vec<u8, Global>, hash_type: T) -> HoloHash<T>
[src]
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.
impl<P> HoloHash<P> where
P: PrimitiveHashType,
[src]
P: PrimitiveHashType,
pub fn from_raw_36(hash: Vec<u8, Global>) -> HoloHash<P>
[src]
Construct from 36 raw bytes, using the known PrimitiveHashType
pub fn from_raw_32(hash: Vec<u8, Global>) -> HoloHash<P>
[src]
Construct a HoloHash from a prehashed raw 32-byte slice. The location bytes will be calculated.
impl<T> HoloHash<T> where
T: HashTypeSync,
[src]
T: HashTypeSync,
pub fn with_data_sync<C>(content: &C) -> HoloHash<T> where
C: HashableContent<HashType = T>,
[src]
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!
impl<T> HoloHash<T> where
T: HashTypeAsync,
[src]
T: HashTypeAsync,
pub async fn with_data<C>(content: &'_ C) -> HoloHash<T> where
C: HashableContent<HashType = T>,
[src]
C: HashableContent<HashType = T>,
Asynchronously hash a reference to the given content to produce a HoloHash
Trait Implementations
impl<T> AsRef<[u8]> for HoloHash<T> where
T: HashType,
[src]
T: HashType,
impl AsRef<HoloHash<Agent>> for VerifySignature
[src]
impl<T> Clone for HoloHash<T> where
T: HashType + Clone,
[src]
T: HashType + Clone,
impl<T> Debug for HoloHash<T> where
T: HashType,
[src]
T: HashType,
impl<'de, T> Deserialize<'de> for HoloHash<T> where
T: HashType,
[src]
T: HashType,
pub fn deserialize<D>(
deserializer: D
) -> Result<HoloHash<T>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
deserializer: D
) -> Result<HoloHash<T>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
impl<T> Display for HoloHash<T> where
T: HashType,
[src]
T: HashType,
impl<T> Eq for HoloHash<T> where
T: HashType + Eq,
[src]
T: HashType + Eq,
impl From<HoloHash<Agent>> for CapGrant
[src]
impl From<HoloHash<Agent>> for HoloHash<AnyDht>
[src]
impl From<HoloHash<Agent>> for HoloHash<Entry>
[src]
impl From<HoloHash<AnyDht>> for HoloHash<Entry>
[src]
impl From<HoloHash<AnyDht>> for HoloHash<Header>
[src]
impl From<HoloHash<Entry>> for HoloHash<Agent>
[src]
impl From<HoloHash<Entry>> for HoloHash<AnyDht>
[src]
impl From<HoloHash<Header>> for HoloHash<AnyDht>
[src]
impl<T> From<HoloHash<T>> for HoloHashB64<T> where
T: HashType,
[src]
T: HashType,
pub fn from(original: HoloHash<T>) -> HoloHashB64<T>
[src]
impl<T> From<HoloHashB64<T>> for HoloHash<T> where
T: HashType,
[src]
T: HashType,
pub fn from(original: HoloHashB64<T>) -> HoloHash<T>
[src]
impl<T> HasHash<T> for HoloHash<T> where
T: HashType,
[src]
T: HashType,
impl<T> Hash for HoloHash<T> where
T: HashType + Hash,
[src]
T: HashType + Hash,
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T> IntoIterator for HoloHash<T> where
T: HashType,
[src]
T: HashType,
type Item = u8
The type of the elements being iterated over.
type IntoIter = IntoIter<<HoloHash<T> as IntoIterator>::Item, Global>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> <HoloHash<T> as IntoIterator>::IntoIter
[src]
impl<T> Ord for HoloHash<T> where
T: HashType + Ord,
[src]
T: HashType + Ord,
pub fn cmp(&self, other: &HoloHash<T>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T> PartialEq<HoloHash<T>> for HoloHash<T> where
T: HashType + PartialEq<T>,
[src]
T: HashType + PartialEq<T>,
pub fn eq(&self, other: &HoloHash<T>) -> bool
[src]
pub fn ne(&self, other: &HoloHash<T>) -> bool
[src]
impl<T> PartialOrd<HoloHash<T>> for HoloHash<T> where
T: HashType + PartialOrd<T>,
[src]
T: HashType + PartialOrd<T>,
pub fn partial_cmp(&self, other: &HoloHash<T>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T> Serialize for HoloHash<T> where
T: HashType,
[src]
T: HashType,
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
impl<T> StructuralEq for HoloHash<T> where
T: HashType,
[src]
T: HashType,
impl<T> StructuralPartialEq for HoloHash<T> where
T: HashType,
[src]
T: HashType,
impl<'_, T> TryFrom<&'_ HoloHash<T>> for SerializedBytes where
T: HashType,
[src]
T: HashType,
type Error = SerializedBytesError
The type returned in the event of a conversion error.
pub fn try_from(
t: &HoloHash<T>
) -> Result<SerializedBytes, SerializedBytesError>
[src]
t: &HoloHash<T>
) -> Result<SerializedBytes, SerializedBytesError>
impl<'_, P> TryFrom<&'_ String> for HoloHash<P> where
P: PrimitiveHashType,
[src]
P: PrimitiveHashType,
type Error = HoloHashError
The type returned in the event of a conversion error.
pub fn try_from(s: &String) -> Result<HoloHash<P>, HoloHashError>
[src]
impl<'_, P> TryFrom<&'_ str> for HoloHash<P> where
P: PrimitiveHashType,
[src]
P: PrimitiveHashType,
type Error = HoloHashError
The type returned in the event of a conversion error.
pub fn try_from(s: &str) -> Result<HoloHash<P>, HoloHashError>
[src]
impl<T> TryFrom<HoloHash<T>> for SerializedBytes where
T: HashType,
[src]
T: HashType,
type Error = SerializedBytesError
The type returned in the event of a conversion error.
pub fn try_from(t: HoloHash<T>) -> Result<SerializedBytes, SerializedBytesError>
[src]
impl<T> TryFrom<SerializedBytes> for HoloHash<T> where
T: HashType,
[src]
T: HashType,
type Error = SerializedBytesError
The type returned in the event of a conversion error.
pub fn try_from(
sb: SerializedBytes
) -> Result<HoloHash<T>, SerializedBytesError>
[src]
sb: SerializedBytes
) -> Result<HoloHash<T>, SerializedBytesError>
impl<P> TryFrom<String> for HoloHash<P> where
P: PrimitiveHashType,
[src]
P: PrimitiveHashType,
type Error = HoloHashError
The type returned in the event of a conversion error.
pub fn try_from(s: String) -> Result<HoloHash<P>, HoloHashError>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for HoloHash<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for HoloHash<T> where
T: Send,
T: Send,
impl<T> Sync for HoloHash<T> where
T: Sync,
T: Sync,
impl<T> Unpin for HoloHash<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for HoloHash<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub 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;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
pub 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;
[src]
Notable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,