Struct rhai::NativeCallContext[][src]

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

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. Available under the internals feature only.

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.

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

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

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]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

(INTERNALS) The current set of namespaces containing definitions of all script-defined functions. Available 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]

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

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

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]

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

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

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

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

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.

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.