Struct rhai::FnPtr [−][src]
pub struct FnPtr(_, _);
Expand description
A general function pointer, which may carry additional (i.e. curried) argument values to be passed onto a function during a call.
Implementations
impl FnPtr
[src]
impl FnPtr
[src]pub fn new(name: impl Into<Identifier>) -> Result<Self, Box<EvalAltResult>>
[src]
pub fn new(name: impl Into<Identifier>) -> Result<Self, Box<EvalAltResult>>
[src]Create a new function pointer.
pub fn set_curry(
&mut self,
values: impl IntoIterator<Item = Dynamic>
) -> &mut Self
[src]
pub fn set_curry(
&mut self,
values: impl IntoIterator<Item = Dynamic>
) -> &mut Self
[src]Set curried arguments to the function pointer.
pub fn is_curried(&self) -> bool
[src]
pub fn is_curried(&self) -> bool
[src]Is the function pointer curried?
pub fn is_anonymous(&self) -> bool
[src]
pub fn is_anonymous(&self) -> bool
[src]Does the function pointer refer to an anonymous function?
Not available under no_function
.
pub fn call_dynamic(
&self,
ctx: &NativeCallContext<'_>,
this_ptr: Option<&mut Dynamic>,
arg_values: impl AsMut<[Dynamic]>
) -> Result<Dynamic, Box<EvalAltResult>>
[src]
pub fn call_dynamic(
&self,
ctx: &NativeCallContext<'_>,
this_ptr: Option<&mut Dynamic>,
arg_values: impl AsMut<[Dynamic]>
) -> Result<Dynamic, Box<EvalAltResult>>
[src]Call the function pointer with curried arguments (if any).
If this function is a script-defined function, it must not be marked private.
WARNING
All the arguments are consumed, meaning that they’re 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.
Trait Implementations
impl TryFrom<ImmutableString> for FnPtr
[src]
impl TryFrom<ImmutableString> for FnPtr
[src]type Error = Box<EvalAltResult>
type Error = Box<EvalAltResult>
The type returned in the event of a conversion error.
fn try_from(value: ImmutableString) -> Result<Self, Self::Error>
[src]
fn try_from(value: ImmutableString) -> Result<Self, Self::Error>
[src]Performs the conversion.
impl TryFrom<SmartString<Compact>> for FnPtr
[src]
impl TryFrom<SmartString<Compact>> for FnPtr
[src]type Error = Box<EvalAltResult>
type Error = Box<EvalAltResult>
The type returned in the event of a conversion error.
fn try_from(value: Identifier) -> Result<Self, Self::Error>
[src]
fn try_from(value: Identifier) -> Result<Self, Self::Error>
[src]Performs the conversion.
Auto Trait Implementations
impl !RefUnwindSafe for FnPtr
impl !Send for FnPtr
impl !Sync for FnPtr
impl Unpin for FnPtr
impl !UnwindSafe for FnPtr
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more