Struct quad_compat_rhai::FnCallHashes[][src]

pub struct FnCallHashes {
    pub script: u64,
    pub native: u64,
}
Expand description

(internals) A set of function call hashes. Exported under the internals feature only.

Two separate hashes are pre-calculated because of the following patterns:

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 number 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 complete native function call hash always contains the called function’s name plus the types of the arguments. This is due to possible function overloading for different parameter types.

Fields

script: u64

Pre-calculated hash for a script-defined function (zero if native functions only).

native: u64

Pre-calculated hash for a native Rust function with no parameter types.

Implementations

Create a FnCallHashes with only the native Rust hash.

Create a FnCallHashes with both native Rust and script function hashes.

Is this FnCallHashes native Rust only?

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.