pub struct MiraNativeFn { /* private fields */ }Expand description
A named, single-threaded native function callable from MiraScript.
Implementations§
Source§impl MiraNativeFn
impl MiraNativeFn
Sourcepub fn new<V, E, F>(name: impl Into<FunctionName>, callback: F) -> Self
pub fn new<V, E, F>(name: impl Into<FunctionName>, callback: F) -> Self
Create a named native callback.
Sourcepub fn builtin(
name: impl Into<FunctionName>,
callback: impl Fn(&mut Runtime, &[MiraValue]) -> Result<MiraManageable> + 'static,
) -> Self
pub fn builtin( name: impl Into<FunctionName>, callback: impl Fn(&mut Runtime, &[MiraValue]) -> Result<MiraManageable> + 'static, ) -> Self
Create an internal callback already using the VM result type.
Sourcepub fn with_name(self, name: impl Into<FunctionName>) -> Self
pub fn with_name(self, name: impl Into<FunctionName>) -> Self
Replace the diagnostic name.
Trait Implementations§
Source§impl Clone for MiraNativeFn
impl Clone for MiraNativeFn
Source§fn clone(&self) -> MiraNativeFn
fn clone(&self) -> MiraNativeFn
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MiraNativeFn
impl Debug for MiraNativeFn
Source§impl From<MiraNativeFn> for MiraManageable
impl From<MiraNativeFn> for MiraManageable
Source§fn from(value: MiraNativeFn) -> Self
fn from(value: MiraNativeFn) -> Self
Converts to this type from the input type.
Source§impl MiraFunction for MiraNativeFn
impl MiraFunction for MiraNativeFn
Auto Trait Implementations§
impl !RefUnwindSafe for MiraNativeFn
impl !Send for MiraNativeFn
impl !Sync for MiraNativeFn
impl !UnwindSafe for MiraNativeFn
impl Freeze for MiraNativeFn
impl Unpin for MiraNativeFn
impl UnsafeUnpin for MiraNativeFn
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