Struct rhai::FnCallHash [−][src]
(INTERNALS) An set of function call hashes.
Exported under the internals
feature only.
Two separate hashes are pre-calculated because of the following pattern:
func(a, b, c); // Native: func(a, b, c) - 3 parameters // Script: func(a, b, c) - 3 parameters a.func(b, c); // Native: func(&mut a, b, c) - 3 parameters // Script: func(b, c) - 2 parameters
For normal function calls, the native hash equals the script hash. For method-style calls, the script hash contains one fewer parameter.
Function call hashes are used in the following manner:
-
First, the script hash is tried, which contains only the called function’s name plus the of parameters.
-
Next, the actual types of arguments are hashed and combined with the native hash, which is then used to search for a native function. In other words, a native function call hash always contains the called function’s name plus the types of the arguments. This is to due to possible function overloading for different parameter types.
Volatile Data Structure
This type is volatile and may change.
Fields
script: Option<u64>
Pre-calculated hash for a script-defined function (None
if native functions only).
native: u64
Pre-calculated hash for a native Rust function with no parameter types.
Implementations
impl FnCallHash
[src]
pub fn from_native(hash: u64) -> Self
[src]
Create a FnCallHash
with only the native Rust hash.
pub fn from_script(hash: u64) -> Self
[src]
Create a FnCallHash
with both native Rust and script function hashes set to the same value.
pub fn from_script_and_native(script: u64, native: u64) -> Self
[src]
Create a FnCallHash
with both native Rust and script function hashes.
pub fn is_native_only(&self) -> bool
[src]
Is this FnCallHash
native Rust only?
pub fn script_hash(&self) -> u64
[src]
Get the script function hash from this FnCallHash
.
Panics
Panics if the FnCallHash
is native Rust only.
pub fn native_hash(&self) -> u64
[src]
Get the naive Rust function hash from this FnCallHash
.
Trait Implementations
impl Clone for FnCallHash
[src]
fn clone(&self) -> FnCallHash
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for FnCallHash
[src]
impl Debug for FnCallHash
[src]
impl Default for FnCallHash
[src]
fn default() -> FnCallHash
[src]
impl Eq for FnCallHash
[src]
impl Hash for FnCallHash
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<FnCallHash> for FnCallHash
[src]
fn eq(&self, other: &FnCallHash) -> bool
[src]
fn ne(&self, other: &FnCallHash) -> bool
[src]
impl StructuralEq for FnCallHash
[src]
impl StructuralPartialEq for FnCallHash
[src]
Auto Trait Implementations
impl RefUnwindSafe for FnCallHash
impl Send for FnCallHash
impl Sync for FnCallHash
impl Unpin for FnCallHash
impl UnwindSafe for FnCallHash
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow(&self) -> &TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
[src]
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
[src]
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
impl<T> CallHasher for T where
T: Hash + ?Sized,
[src]
T: Hash + ?Sized,
pub default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64 where
H: Hash + ?Sized,
B: BuildHasher,
[src]
H: Hash + ?Sized,
B: BuildHasher,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,