Struct muse_lang::runtime::value::RustFunctionTable
source · pub struct RustFunctionTable<T> { /* private fields */ }Expand description
A table containing Rust-defined functions for various names and arities.
Implementations§
source§impl<T> RustFunctionTable<T>where
T: CustomType + Trace,
impl<T> RustFunctionTable<T>where
T: CustomType + Trace,
sourcepub fn with_fn<F>(
self,
name: impl SymbolList,
arity: impl Into<Arity>,
func: F,
) -> Self
pub fn with_fn<F>( self, name: impl SymbolList, arity: impl Into<Arity>, func: F, ) -> Self
Adds a function with name and arity to this table, and returns self.q
sourcepub fn invoke(
&self,
vm: &mut VmContext<'_, '_>,
name: &SymbolRef,
arity: Arity,
this: &Rooted<T>,
) -> Result<Value, Fault>
pub fn invoke( &self, vm: &mut VmContext<'_, '_>, name: &SymbolRef, arity: Arity, this: &Rooted<T>, ) -> Result<Value, Fault>
Invokes a function named name with arity arguments.
§Errors
Fault::UnknownSymbol: Returned if this table has no functions with the given name.Fault::IncorrectNumberOfArguments: Returned if no functions with the given name accept the given number of arguments.
Auto Trait Implementations§
impl<T> Freeze for RustFunctionTable<T>
impl<T> !RefUnwindSafe for RustFunctionTable<T>
impl<T> Send for RustFunctionTable<T>
impl<T> Sync for RustFunctionTable<T>
impl<T> Unpin for RustFunctionTable<T>
impl<T> !UnwindSafe for RustFunctionTable<T>
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