#[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<Self>
pub fn as_non_empty(&self) -> Option<Self>
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) -> Self
pub fn type_hash(path: impl ToTypeHash) -> Self
Get the hash of a type.
Sourcepub fn associated_function(
type_hash: impl IntoHash,
name: impl IntoHash,
) -> Self
pub fn associated_function( type_hash: impl IntoHash, name: impl IntoHash, ) -> Self
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,
) -> Self
pub fn field_function( protocol: impl IntoHash, type_hash: Hash, name: impl IntoHash, ) -> Self
Construct a hash corresponding to a field function.
Sourcepub fn index_function(
protocol: impl IntoHash,
type_hash: Hash,
index: Hash,
) -> Self
pub fn index_function( protocol: impl IntoHash, type_hash: Hash, index: Hash, ) -> Self
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) -> Self
pub fn object_keys<I>(keys: I) -> Self
Hash the given iterator of object keys.
Sourcepub const fn with_generics(self, generics: Self) -> Self
pub const fn with_generics(self, generics: Self) -> Self
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: Self) -> Self
pub const fn with_type_parameters(self, ty: Self) -> Self
Mix the current hash with type parameters.
Sourcepub const fn with_function_parameters(self, f: Self) -> Self
pub const fn with_function_parameters(self, f: Self) -> Self
Mix the current hash with function parameters.
Sourcepub const fn parameters<const N: usize>(params: [Hash; N]) -> Self
pub const fn parameters<const N: usize>(params: [Hash; N]) -> Self
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::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 PartialOrd for Hash
impl PartialOrd for Hash
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)