pub struct NativeFn {
pub name: Arc<str>,
pub arity: Arity,
pub func: NativeFnFunc,
}Fields§
§name: Arc<str>§arity: Arity§func: NativeFnFuncImplementations§
Source§impl NativeFn
impl NativeFn
Sourcepub fn new(name: impl Into<Arc<str>>, arity: Arity, func: NativeFnPtr) -> Self
pub fn new(name: impl Into<Arc<str>>, arity: Arity, func: NativeFnPtr) -> Self
Create from a bare function pointer (backwards-compatible).
Sourcepub fn with_closure(
name: impl Into<Arc<str>>,
arity: Arity,
func: impl Fn(&[Value]) -> ValueResult<Value> + 'static,
) -> Self
pub fn with_closure( name: impl Into<Arc<str>>, arity: Arity, func: impl Fn(&[Value]) -> ValueResult<Value> + 'static, ) -> Self
Create from a closure or any Fn(&[Value]) -> ValueResult<Value>.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for NativeFn
impl !Send for NativeFn
impl !Sync for NativeFn
impl !UnwindSafe for NativeFn
impl Freeze for NativeFn
impl Unpin for NativeFn
impl UnsafeUnpin for NativeFn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more