Struct rhai::FnCallHashes [−][src]
Expand description
(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 FnCallHashes
[src]
impl FnCallHashes
[src]pub fn from_native(hash: u64) -> Self
[src]
pub fn from_native(hash: u64) -> Self
[src]Create a FnCallHashes
with only the native Rust hash.
pub fn from_script(hash: u64) -> Self
[src]
pub fn from_script(hash: u64) -> Self
[src]Create a FnCallHashes
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]
pub fn from_script_and_native(script: u64, native: u64) -> Self
[src]Create a FnCallHashes
with both native Rust and script function hashes.
pub fn is_native_only(&self) -> bool
[src]
pub fn is_native_only(&self) -> bool
[src]Is this FnCallHashes
native Rust only?
pub fn script_hash(&self) -> Option<u64>
[src]
pub fn script_hash(&self) -> Option<u64>
[src]Get the script function hash from this FnCallHashes
.
pub fn native_hash(&self) -> u64
[src]
pub fn native_hash(&self) -> u64
[src]Get the naive Rust function hash from this FnCallHashes
.
Trait Implementations
impl Clone for FnCallHashes
[src]
impl Clone for FnCallHashes
[src]fn clone(&self) -> FnCallHashes
[src]
fn clone(&self) -> FnCallHashes
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for FnCallHashes
[src]
impl Debug for FnCallHashes
[src]impl Default for FnCallHashes
[src]
impl Default for FnCallHashes
[src]fn default() -> FnCallHashes
[src]
fn default() -> FnCallHashes
[src]Returns the “default value” for a type. Read more
impl Hash for FnCallHashes
[src]
impl Hash for FnCallHashes
[src]impl PartialEq<FnCallHashes> for FnCallHashes
[src]
impl PartialEq<FnCallHashes> for FnCallHashes
[src]fn eq(&self, other: &FnCallHashes) -> bool
[src]
fn eq(&self, other: &FnCallHashes) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &FnCallHashes) -> bool
[src]
fn ne(&self, other: &FnCallHashes) -> bool
[src]This method tests for !=
.
impl Copy for FnCallHashes
[src]
impl Eq for FnCallHashes
[src]
impl StructuralEq for FnCallHashes
[src]
impl StructuralPartialEq for FnCallHashes
[src]
Auto Trait Implementations
impl RefUnwindSafe for FnCallHashes
impl Send for FnCallHashes
impl Sync for FnCallHashes
impl Unpin for FnCallHashes
impl UnwindSafe for FnCallHashes
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> CallHasher for T where
T: Hash + ?Sized,
[src]
impl<T> CallHasher for T where
T: Hash + ?Sized,
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more