pub struct Hash(/* private fields */);
Expand description
The primitive hash that among other things is used to reference items, types, and native functions.
Implementations§
source§impl Hash
impl Hash
sourcepub fn ident(name: &str) -> Hash
pub fn ident(name: &str) -> Hash
Get the hash corresponding to a string identifier like function
or
hello_world
.
sourcepub fn type_hash<I>(path: I) -> Hashwhere
I: ToTypeHash,
pub fn type_hash<I>(path: I) -> Hashwhere
I: ToTypeHash,
Get the hash of a type.
sourcepub fn associated_function<N>(type_hash: Hash, name: N) -> Hashwhere
N: IntoHash,
pub fn associated_function<N>(type_hash: Hash, name: N) -> Hashwhere
N: IntoHash,
Construct a hash to an instance function, where the instance is a pre-determined type.
sourcepub fn field_function<N>(protocol: Protocol, type_hash: Hash, name: N) -> Hashwhere
N: IntoHash,
pub fn field_function<N>(protocol: Protocol, type_hash: Hash, name: N) -> Hashwhere
N: IntoHash,
Construct a hash corresponding to a field function.
sourcepub fn index_function(protocol: Protocol, type_hash: Hash, index: Hash) -> Hash
pub fn index_function(protocol: Protocol, type_hash: Hash, index: Hash) -> Hash
Construct an index function.
sourcepub fn static_bytes(bytes: &[u8]) -> Hash
pub fn static_bytes(bytes: &[u8]) -> Hash
Get the hash corresponding to a static byte array.
sourcepub fn object_keys<I>(keys: I) -> Hash
pub fn object_keys<I>(keys: I) -> Hash
Hash the given iterator of object keys.
sourcepub const fn with_generics(self, generics: Hash) -> Hash
pub const fn with_generics(self, generics: Hash) -> Hash
Mix in generics hash.
The generics hash must be a combination of the output from
with_type_parameters
and with_function_parameters
.
sourcepub const fn with_type_parameters(self, ty: Hash) -> Hash
pub const fn with_type_parameters(self, ty: Hash) -> Hash
Mix the current hash with type parameters.
sourcepub const fn with_function_parameters(self, f: Hash) -> Hash
pub const fn with_function_parameters(self, f: Hash) -> Hash
Mix the current hash with function parameters.
sourcepub fn parameters<I>(parameters: I) -> Hash
pub fn parameters<I>(parameters: I) -> Hash
Hash type parameters.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Hash
impl<'de> Deserialize<'de> for Hash
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Hash, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Hash, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Hash
impl Ord for Hash
source§impl PartialEq for Hash
impl PartialEq for Hash
source§impl PartialOrd for Hash
impl PartialOrd for Hash
1.0.0 · source§fn 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 moresource§impl Serialize for Hash
impl Serialize for Hash
source§fn 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
impl Copy for Hash
impl Eq for Hash
impl StructuralPartialEq for Hash
impl ToTypeHash for Hash
Auto Trait Implementations§
impl Freeze for Hash
impl RefUnwindSafe for Hash
impl Send for Hash
impl Sync for Hash
impl Unpin for Hash
impl UnwindSafe for Hash
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.