#[repr(transparent)]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 as_non_empty(&self) -> Option<Hash>
pub fn as_non_empty(&self) -> Option<Hash>
Return the current hash if it is non-empty.
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(path: impl ToTypeHash) -> Hash
pub fn type_hash(path: impl ToTypeHash) -> Hash
Get the hash of a type.
Sourcepub fn associated_function(
type_hash: impl IntoHash,
name: impl IntoHash,
) -> Hash
pub fn associated_function( type_hash: impl IntoHash, name: impl IntoHash, ) -> Hash
Construct a hash to an instance function, where the instance is a pre-determined type.
Sourcepub fn field_function(
protocol: impl IntoHash,
type_hash: Hash,
name: impl IntoHash,
) -> Hash
pub fn field_function( protocol: impl IntoHash, type_hash: Hash, name: impl IntoHash, ) -> Hash
Construct a hash corresponding to a field function.
Sourcepub fn index_function(
protocol: impl IntoHash,
type_hash: Hash,
index: Hash,
) -> Hash
pub fn index_function( protocol: impl IntoHash, 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.
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 From<Hash> for ConstValue
impl From<Hash> for ConstValue
Source§impl FromValue for Hash
impl FromValue for Hash
Source§fn from_value(value: Value) -> Result<Self, RuntimeError>
fn from_value(value: Value) -> Result<Self, RuntimeError>
Try to convert to the given type, from the given value.
Source§impl InstallWith for Hash
impl InstallWith for Hash
Source§fn install_with(_: &mut Module) -> Result<(), ContextError>
fn install_with(_: &mut Module) -> Result<(), ContextError>
Hook to install more things into the module.
Source§impl IntoOutput for Hash
impl IntoOutput for Hash
Source§fn into_output(self) -> Result<Value, RuntimeError>
fn into_output(self) -> Result<Value, RuntimeError>
Coerce the current value into an output.
Source§impl MaybeTypeOf for Hash
impl MaybeTypeOf for Hash
Source§fn maybe_type_of() -> Result<DocType>
fn maybe_type_of() -> Result<DocType>
Type information for the given type.
Source§impl Ord for Hash
impl Ord for Hash
Source§impl PartialOrd for Hash
impl PartialOrd for Hash
Source§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
Source§impl ToConstValue for Hash
impl ToConstValue for Hash
Source§fn to_const_value(self) -> Result<ConstValue, RuntimeError>
fn to_const_value(self) -> Result<ConstValue, RuntimeError>
Convert into a constant value.
Source§impl TypeOf for Hash
impl TypeOf for Hash
Source§const STATIC_TYPE_INFO: AnyTypeInfo
const STATIC_TYPE_INFO: AnyTypeInfo
Access diagnostical type information for the current type. Read more
Source§const PARAMETERS: Hash = Hash::EMPTY
const PARAMETERS: Hash = Hash::EMPTY
Type parameters for the type. 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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> TryToOwned for Twhere
T: TryClone,
impl<T> TryToOwned for Twhere
T: TryClone,
Source§impl<T> TryToString for Twhere
T: Display,
impl<T> TryToString for Twhere
T: Display,
Source§impl<T> UnsafeToValue for Twhere
T: ToValue,
impl<T> UnsafeToValue for Twhere
T: ToValue,
Source§unsafe fn unsafe_to_value(
self,
) -> Result<(Value, <T as UnsafeToValue>::Guard), RuntimeError>
unsafe fn unsafe_to_value( self, ) -> Result<(Value, <T as UnsafeToValue>::Guard), RuntimeError>
Convert into a value. Read more