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

Match on the primitive hash type represented by this composite hash type

source

pub fn into_entry_hash(self) -> Option<HoloHash<Entry>>

If this hash represents an EntryHash, return it, else None

If this hash represents a HeaderHash, return it, else None

If this hash represents an ExternalHash, return it, else None

Match on the primitive hash type represented by this composite hash type

source

pub fn into_entry_hash(self) -> Option<HoloHash<Entry>>

If this hash represents an EntryHash, return it, else None

If this hash represents a HeaderHash, return it, else None

Raw constructor: Create a HoloHash from 39 bytes, using the prefix bytes to determine the hash_type

Raw constructor: Create a HoloHash from 39 bytes, using the prefix bytes to determine the hash_type. Panics if hash_type does not match.

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.

Change the type of this HoloHash, keeping the same bytes

The HashType of this hash

Get the raw 39-byte Vec including the 3 byte prefix, base 32 bytes, and the 4 byte loc

Get 36-byte Vec which excludes the 3 byte prefix

Fetch just the core 32 bytes (without the 4 location bytes)

Fetch the holo dht location for this hash

consume into the inner byte vector

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.

Construct from 36 raw bytes, using the known PrimitiveHashType

Construct a HoloHash from a prehashed raw 32-byte slice. The location bytes will be calculated.

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!

Asynchronously hash a reference to the given content to produce a HoloHash

Trait Implementations

create a new agent keypair in given keystore, returning the AgentPubKey

sign some arbitrary raw bytes

verify a signature for given raw bytes with this agent public_key is valid

sign some arbitrary data

verify a signature for given data with this agent public_key is valid

Generate an arbitrary value of Self from the given unstructured data. Read more

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Generate an arbitrary value of Self from the given unstructured data. Read more

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Converts this type into a shared reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Sets ChainTopOrdering to default = Strict when created from a hash.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts SQLite value into Rust value.

Get the hash by reference

Convert to the owned hash

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

Converts Rust value to SQLite value

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Attaches the provided Context to this type, returning a WithContext wrapper. Read more

Attaches the current Context to this type, returning a WithContext wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more