Struct hdk::prelude::HoloHash[][src]

pub struct HoloHash<T> where
    T: HashType
{ /* fields omitted */ }

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]

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]

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]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [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]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Get 36-byte Vec which excludes the 3 byte prefix

pub fn get_raw_32(&self) -> &[u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [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>

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
[src]

consume into the inner byte vector

impl<T> HoloHash<T> where
    T: HashType
[src]

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]

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]

pub fn with_data_sync<C>(content: &C) -> HoloHash<T> where
    C: HashableContent<HashType = T>, 
[src]

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]

pub async fn with_data<C>(content: &'_ C) -> HoloHash<T> where
    C: HashableContent<HashType = T>, 
[src]

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]

impl AsRef<HoloHash<Agent>> for VerifySignature[src]

impl<T> Clone for HoloHash<T> where
    T: HashType + Clone
[src]

impl<T> Debug for HoloHash<T> where
    T: HashType
[src]

impl<'de, T> Deserialize<'de> for HoloHash<T> where
    T: HashType
[src]

impl<T> Display for HoloHash<T> where
    T: HashType
[src]

impl<T> Eq for HoloHash<T> where
    T: HashType + Eq
[src]

impl From<HoloHash<Agent>> for CapGrant[src]

impl From<HoloHash<Agent>> for HoloHash<Entry>[src]

impl From<HoloHash<Agent>> for HoloHash<AnyDht>[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]

impl<T> From<HoloHashB64<T>> for HoloHash<T> where
    T: HashType
[src]

impl<T> HasHash<T> for HoloHash<T> where
    T: HashType
[src]

impl<T> Hash for HoloHash<T> where
    T: HashType + Hash
[src]

impl<T> IntoIterator for HoloHash<T> where
    T: HashType
[src]

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?

impl<T> Ord for HoloHash<T> where
    T: HashType + Ord
[src]

impl<T> PartialEq<HoloHash<T>> for HoloHash<T> where
    T: HashType + PartialEq<T>, 
[src]

impl<T> PartialOrd<HoloHash<T>> for HoloHash<T> where
    T: HashType + PartialOrd<T>, 
[src]

impl<T> Serialize for HoloHash<T> where
    T: HashType
[src]

impl<T> StructuralEq for HoloHash<T> where
    T: HashType
[src]

impl<T> StructuralPartialEq for HoloHash<T> where
    T: HashType
[src]

impl<'_, T> TryFrom<&'_ HoloHash<T>> for SerializedBytes where
    T: HashType
[src]

type Error = SerializedBytesError

The type returned in the event of a conversion error.

impl<'_, P> TryFrom<&'_ String> for HoloHash<P> where
    P: PrimitiveHashType
[src]

type Error = HoloHashError

The type returned in the event of a conversion error.

impl<'_, P> TryFrom<&'_ str> for HoloHash<P> where
    P: PrimitiveHashType
[src]

type Error = HoloHashError

The type returned in the event of a conversion error.

impl<T> TryFrom<HoloHash<T>> for SerializedBytes where
    T: HashType
[src]

type Error = SerializedBytesError

The type returned in the event of a conversion error.

impl<T> TryFrom<SerializedBytes> for HoloHash<T> where
    T: HashType
[src]

type Error = SerializedBytesError

The type returned in the event of a conversion error.

impl<P> TryFrom<String> for HoloHash<P> where
    P: PrimitiveHashType
[src]

type Error = HoloHashError

The type returned in the event of a conversion error.

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 T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,