Enum rhai::plugin::CallableFunction [−][src]
A type encapsulating a function callable by Rhai.
Variants
Pure(Shared<dyn Fn(NativeCallContext<'_>, &mut FnCallArgs<'_>) -> Result<Dynamic, Box<EvalAltResult>>>)
A pure native Rust function with all arguments passed by value.
Method(Shared<dyn Fn(NativeCallContext<'_>, &mut FnCallArgs<'_>) -> Result<Dynamic, Box<EvalAltResult>>>)
A native Rust object method with the first argument passed by reference, and the rest passed by value.
An iterator function.
Plugin(Shared<dyn PluginFunction>)
A plugin function,
Script(Shared<ScriptFnDef>)
A script-defined function.
Implementations
impl CallableFunction
[src]
pub fn is_pure(&self) -> bool
[src]
Is this a pure native Rust function?
pub fn is_method(&self) -> bool
[src]
Is this a native Rust method function?
pub fn is_iter(&self) -> bool
[src]
Is this an iterator function?
pub fn is_script(&self) -> bool
[src]
Is this a Rhai-scripted function?
pub fn is_plugin_fn(&self) -> bool
[src]
Is this a plugin function?
pub fn is_native(&self) -> bool
[src]
Is this a native Rust function?
pub fn access(&self) -> FnAccess
[src]
Get the access mode.
pub fn get_native_fn(
&self
) -> &Shared<dyn Fn(NativeCallContext<'_>, &mut FnCallArgs<'_>) -> Result<Dynamic, Box<EvalAltResult>>>
[src]
&self
) -> &Shared<dyn Fn(NativeCallContext<'_>, &mut FnCallArgs<'_>) -> Result<Dynamic, Box<EvalAltResult>>>
Get a shared reference to a native Rust function.
Panics
Panics if the CallableFunction
is not Pure
or
Method
.
pub fn get_fn_def(&self) -> &Shared<ScriptFnDef>
[src]
Get a shared reference to a script-defined function definition.
Panics
Panics if the CallableFunction
is not Script
.
pub fn get_iter_fn(&self) -> fn(_: Dynamic) -> Box<dyn Iterator<Item = Dynamic>>
[src]
pub fn get_plugin_fn<'s>(&'s self) -> &Shared<dyn PluginFunction>
[src]
pub fn from_pure(
func: Box<dyn Fn(NativeCallContext<'_>, &mut FnCallArgs<'_>) -> Result<Dynamic, Box<EvalAltResult>>>
) -> Self
[src]
func: Box<dyn Fn(NativeCallContext<'_>, &mut FnCallArgs<'_>) -> Result<Dynamic, Box<EvalAltResult>>>
) -> Self
Create a new CallableFunction::Pure
.
pub fn from_method(
func: Box<dyn Fn(NativeCallContext<'_>, &mut FnCallArgs<'_>) -> Result<Dynamic, Box<EvalAltResult>>>
) -> Self
[src]
func: Box<dyn Fn(NativeCallContext<'_>, &mut FnCallArgs<'_>) -> Result<Dynamic, Box<EvalAltResult>>>
) -> Self
Create a new CallableFunction::Method
.
pub fn from_plugin(func: impl PluginFunction + 'static + SendSync) -> Self
[src]
Create a new CallableFunction::Plugin
.
Trait Implementations
impl Clone for CallableFunction
[src]
fn clone(&self) -> CallableFunction
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for CallableFunction
[src]
impl Display for CallableFunction
[src]
impl From<Rc<ScriptFnDef>> for CallableFunction
[src]
fn from(_func: Shared<ScriptFnDef>) -> Self
[src]
impl From<Rc<dyn PluginFunction + 'static>> for CallableFunction
[src]
fn from(func: Shared<dyn PluginFunction>) -> Self
[src]
impl From<ScriptFnDef> for CallableFunction
[src]
fn from(_func: ScriptFnDef) -> Self
[src]
impl<T: PluginFunction + 'static + SendSync> From<T> for CallableFunction
[src]
impl From<fn(Dynamic) -> Box<dyn Iterator<Item = Dynamic> + 'static, Global>> for CallableFunction
[src]
Auto Trait Implementations
impl !RefUnwindSafe for CallableFunction
impl !Send for CallableFunction
impl !Sync for CallableFunction
impl Unpin for CallableFunction
impl !UnwindSafe for CallableFunction
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,
pub fn borrow(&self) -> &TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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>,