Enum casbin::rhai::plugin::CallableFunction [−][src]
A type encapsulating a function callable by Rhai.
Variants
A pure native Rust function with all arguments passed by value.
A native Rust object method with the first argument passed by reference, and the rest passed by value.
An iterator function.
Plugin(Arc<dyn PluginFunction + 'static + Sync + Send>)
A plugin 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
) -> &Arc<dyn Fn(NativeCallContext<'_>, &mut [&mut Dynamic]) + 'static + Sync + Send>
[src]
&self
) -> &Arc<dyn Fn(NativeCallContext<'_>, &mut [&mut Dynamic]) + 'static + Sync + Send>
Get a shared reference to a native Rust function.
Panics
Panics if the CallableFunction
is not Pure
or
Method
.
pub fn get_iter_fn(
&self
) -> fn(Dynamic) -> Box<dyn Iterator<Item = Dynamic> + 'static, Global>
[src]
&self
) -> fn(Dynamic) -> Box<dyn Iterator<Item = Dynamic> + 'static, Global>
pub fn get_plugin_fn(
&'s self
) -> &'s Arc<dyn PluginFunction + 'static + Sync + Send>
[src]
&'s self
) -> &'s Arc<dyn PluginFunction + 'static + Sync + Send>
pub fn from_pure(
func: Box<dyn Fn(NativeCallContext<'_>, &mut [&mut Dynamic]) + 'static + Sync + Send, Global>
) -> CallableFunction
[src]
func: Box<dyn Fn(NativeCallContext<'_>, &mut [&mut Dynamic]) + 'static + Sync + Send, Global>
) -> CallableFunction
Create a new CallableFunction::Pure
.
pub fn from_method(
func: Box<dyn Fn(NativeCallContext<'_>, &mut [&mut Dynamic]) + 'static + Sync + Send, Global>
) -> CallableFunction
[src]
func: Box<dyn Fn(NativeCallContext<'_>, &mut [&mut Dynamic]) + 'static + Sync + Send, Global>
) -> CallableFunction
Create a new CallableFunction::Method
.
pub fn from_plugin(
func: impl PluginFunction + SendSync + 'static
) -> CallableFunction
[src]
func: impl PluginFunction + SendSync + 'static
) -> CallableFunction
Create a new CallableFunction::Plugin
.
Trait Implementations
impl Clone for CallableFunction
[src]
pub 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<Arc<dyn PluginFunction + 'static + Sync + Send>> for CallableFunction
[src]
pub fn from(
func: Arc<dyn PluginFunction + 'static + Sync + Send>
) -> CallableFunction
[src]
func: Arc<dyn PluginFunction + 'static + Sync + Send>
) -> CallableFunction
impl<T> From<T> for CallableFunction where
T: 'static + PluginFunction + SendSync,
[src]
T: 'static + PluginFunction + SendSync,
pub fn from(func: T) -> 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,
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> 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>,