Struct casbin::rhai::NativeCallContext [−][src]
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]
) -> NativeCallContext<'a>
[src]
engine: &'a Engine,
fn_name: &'a str,
lib: &'a [&Module]
) -> NativeCallContext<'a>
Create a new NativeCallContext
.
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_namespaces(&self) -> impl Iterator<Item = &Module>
[src]
Get an iterator over the namespaces containing definitions of all script-defined functions.
pub fn call_fn_dynamic_raw(
&self,
fn_name: impl AsRef<str>,
is_method: bool,
args: &mut [&mut Dynamic]
) -> Result<Dynamic, Box<EvalAltResult, Global>>
[src]
&self,
fn_name: impl AsRef<str>,
is_method: bool,
args: &mut [&mut Dynamic]
) -> Result<Dynamic, Box<EvalAltResult, Global>>
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> From<(&'a Engine, &'a str, &'a M)> for NativeCallContext<'a> where
M: AsRef<[&'a Module]> + ?Sized,
[src]
M: AsRef<[&'a Module]> + ?Sized,
impl<'a, M> From<(&'a Engine, &'a str, Option<&'a str>, &'a Imports, &'a M)> for NativeCallContext<'a> where
M: AsRef<[&'a Module]> + ?Sized,
[src]
M: AsRef<[&'a Module]> + ?Sized,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,