Struct rhai::NativeCallContext[][src]

pub struct NativeCallContext<'a> { /* fields omitted */ }
Expand description

Context of a native Rust function call.

Implementations

impl<'a> NativeCallContext<'a>[src]

pub fn new(engine: &'a Engine, fn_name: &'a str, lib: &'a [&Module]) -> Self[src]

Create a new NativeCallContext.

pub fn new_with_all_fields(
    engine: &'a Engine,
    fn_name: &'a str,
    source: &'a Option<&str>,
    imports: &'a Imports,
    lib: &'a [&Module]
) -> Self
[src]

(INTERNALS) Create a new NativeCallContext. Exported under the internals feature only.

Not available under no_module.

pub fn engine(&self) -> &Engine[src]

The current Engine.

pub fn fn_name(&self) -> &str[src]

Name of the function called.

pub fn source(&self) -> Option<&str>[src]

The current source.

pub fn iter_imports(&self) -> impl Iterator<Item = (&str, &Module)>[src]

Get an iterator over the current set of modules imported via import statements.

Not available under no_module.

pub fn imports(&self) -> Option<&Imports>[src]

(INTERNALS) The current set of modules imported via import statements. Exported under the internals feature only.

Not available under no_module.

pub fn iter_namespaces(&self) -> impl Iterator<Item = &Module>[src]

Get an iterator over the namespaces containing definitions of all script-defined functions.

pub fn namespaces(&self) -> &[&Module][src]

(INTERNALS) The current set of namespaces containing definitions of all script-defined functions. Exported under the internals feature only.

pub fn call_fn_dynamic_raw(
    &self,
    fn_name: impl AsRef<str>,
    is_method: bool,
    args: &mut [&mut Dynamic]
) -> Result<Dynamic, Box<EvalAltResult>>
[src]

Call a function inside the call context.

WARNING

All arguments may be consumed, meaning that they may be replaced by (). This is to avoid unnecessarily cloning the arguments.

Do not use the arguments after this call. If they are needed afterwards, clone them before calling this function.

If is_method is true, the first argument is assumed to be passed by reference and is not consumed.

Trait Implementations

impl<'a> Debug for NativeCallContext<'a>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'a, M: AsRef<[&'a Module]> + ?Sized> From<(&'a Engine, &'a str, &'a M)> for NativeCallContext<'a>[src]

fn from(value: (&'a Engine, &'a str, &'a M)) -> Self[src]

Performs the conversion.

impl<'a, M: AsRef<[&'a Module]> + ?Sized> From<(&'a Engine, &'a str, Option<&'a str>, &'a Imports, &'a M)> for NativeCallContext<'a>[src]

fn from(
    value: (&'a Engine, &'a str, Option<&'a str>, &'a Imports, &'a M)
) -> Self
[src]

Performs the conversion.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for NativeCallContext<'a>

impl<'a> !Send for NativeCallContext<'a>

impl<'a> !Sync for NativeCallContext<'a>

impl<'a> Unpin for NativeCallContext<'a>

impl<'a> !UnwindSafe for NativeCallContext<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

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]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.