pub struct NativeProcedure { /* private fields */ }Expand description
A native function.
Implementations§
Source§impl NativeProcedure
impl NativeProcedure
Sourcepub fn new(
name: &'static str,
func: impl Fn(&<TinyLang as Interpreter>::Env, &[<TinyLang as Interpreter>::Expr]) -> Result<<TinyLang as Interpreter>::Value, <TinyLang as Interpreter>::Error> + 'static,
) -> Self
pub fn new( name: &'static str, func: impl Fn(&<TinyLang as Interpreter>::Env, &[<TinyLang as Interpreter>::Expr]) -> Result<<TinyLang as Interpreter>::Value, <TinyLang as Interpreter>::Error> + 'static, ) -> Self
Create a NativeProcedure.
Sourcepub fn register(self, env: &<TinyLang as Interpreter>::Env)
pub fn register(self, env: &<TinyLang as Interpreter>::Env)
Register the function to an environment.
Trait Implementations§
Source§impl AbstractValue<TinyLang> for NativeProcedure
impl AbstractValue<TinyLang> for NativeProcedure
Source§fn apply(
&self,
env: &<TinyLang as Interpreter>::Env,
args: &[<TinyLang as Interpreter>::Expr],
) -> Result<<TinyLang as Interpreter>::Value, <TinyLang as Interpreter>::Error>
fn apply( &self, env: &<TinyLang as Interpreter>::Env, args: &[<TinyLang as Interpreter>::Expr], ) -> Result<<TinyLang as Interpreter>::Value, <TinyLang as Interpreter>::Error>
Call a function. Read more
Source§impl Debug for NativeProcedure
impl Debug for NativeProcedure
Source§impl Display for NativeProcedure
impl Display for NativeProcedure
Source§impl<R, A> From<(&'static str, fn(&A) -> Result<R, <TinyLang as Interpreter>::Error>)> for NativeProcedure
impl<R, A> From<(&'static str, fn(&A) -> Result<R, <TinyLang as Interpreter>::Error>)> for NativeProcedure
Source§impl<R, A, B> From<(&'static str, fn(&A, &B) -> Result<R, <TinyLang as Interpreter>::Error>)> for NativeProcedure
impl<R, A, B> From<(&'static str, fn(&A, &B) -> Result<R, <TinyLang as Interpreter>::Error>)> for NativeProcedure
Source§impl<R, A, B, C> From<(&'static str, fn(&A, &B, &C) -> R)> for NativeProcedurewhere
R: AbstractValue<TinyLang>,
A: AbstractValue<TinyLang>,
B: AbstractValue<TinyLang>,
C: AbstractValue<TinyLang>,
impl<R, A, B, C> From<(&'static str, fn(&A, &B, &C) -> R)> for NativeProcedurewhere
R: AbstractValue<TinyLang>,
A: AbstractValue<TinyLang>,
B: AbstractValue<TinyLang>,
C: AbstractValue<TinyLang>,
Source§impl<R, A, B, C> From<(&'static str, fn(&A, &B, &C) -> Result<R, <TinyLang as Interpreter>::Error>)> for NativeProcedurewhere
R: AbstractValue<TinyLang>,
A: AbstractValue<TinyLang>,
B: AbstractValue<TinyLang>,
C: AbstractValue<TinyLang>,
impl<R, A, B, C> From<(&'static str, fn(&A, &B, &C) -> Result<R, <TinyLang as Interpreter>::Error>)> for NativeProcedurewhere
R: AbstractValue<TinyLang>,
A: AbstractValue<TinyLang>,
B: AbstractValue<TinyLang>,
C: AbstractValue<TinyLang>,
Source§impl<R, A, B, C, D> From<(&'static str, fn(&A, &B, &C, &D) -> R)> for NativeProcedurewhere
R: AbstractValue<TinyLang>,
A: AbstractValue<TinyLang>,
B: AbstractValue<TinyLang>,
C: AbstractValue<TinyLang>,
D: AbstractValue<TinyLang>,
impl<R, A, B, C, D> From<(&'static str, fn(&A, &B, &C, &D) -> R)> for NativeProcedurewhere
R: AbstractValue<TinyLang>,
A: AbstractValue<TinyLang>,
B: AbstractValue<TinyLang>,
C: AbstractValue<TinyLang>,
D: AbstractValue<TinyLang>,
Source§impl<R, A, B, C, D> From<(&'static str, fn(&A, &B, &C, &D) -> Result<R, <TinyLang as Interpreter>::Error>)> for NativeProcedurewhere
R: AbstractValue<TinyLang>,
A: AbstractValue<TinyLang>,
B: AbstractValue<TinyLang>,
C: AbstractValue<TinyLang>,
D: AbstractValue<TinyLang>,
impl<R, A, B, C, D> From<(&'static str, fn(&A, &B, &C, &D) -> Result<R, <TinyLang as Interpreter>::Error>)> for NativeProcedurewhere
R: AbstractValue<TinyLang>,
A: AbstractValue<TinyLang>,
B: AbstractValue<TinyLang>,
C: AbstractValue<TinyLang>,
D: AbstractValue<TinyLang>,
Source§impl<R, A, B, C, D, E> From<(&'static str, fn(&A, &B, &C, &D, &E) -> R)> for NativeProcedurewhere
R: AbstractValue<TinyLang>,
A: AbstractValue<TinyLang>,
B: AbstractValue<TinyLang>,
C: AbstractValue<TinyLang>,
D: AbstractValue<TinyLang>,
E: AbstractValue<TinyLang>,
impl<R, A, B, C, D, E> From<(&'static str, fn(&A, &B, &C, &D, &E) -> R)> for NativeProcedurewhere
R: AbstractValue<TinyLang>,
A: AbstractValue<TinyLang>,
B: AbstractValue<TinyLang>,
C: AbstractValue<TinyLang>,
D: AbstractValue<TinyLang>,
E: AbstractValue<TinyLang>,
Source§impl<R, A, B, C, D, E> From<(&'static str, fn(&A, &B, &C, &D, &E) -> Result<R, <TinyLang as Interpreter>::Error>)> for NativeProcedurewhere
R: AbstractValue<TinyLang>,
A: AbstractValue<TinyLang>,
B: AbstractValue<TinyLang>,
C: AbstractValue<TinyLang>,
D: AbstractValue<TinyLang>,
E: AbstractValue<TinyLang>,
impl<R, A, B, C, D, E> From<(&'static str, fn(&A, &B, &C, &D, &E) -> Result<R, <TinyLang as Interpreter>::Error>)> for NativeProcedurewhere
R: AbstractValue<TinyLang>,
A: AbstractValue<TinyLang>,
B: AbstractValue<TinyLang>,
C: AbstractValue<TinyLang>,
D: AbstractValue<TinyLang>,
E: AbstractValue<TinyLang>,
Source§impl Trace for NativeProcedure
impl Trace for NativeProcedure
Auto Trait Implementations§
impl !RefUnwindSafe for NativeProcedure
impl !Send for NativeProcedure
impl !Sync for NativeProcedure
impl !UnwindSafe for NativeProcedure
impl Freeze for NativeProcedure
impl Unpin for NativeProcedure
impl UnsafeUnpin for NativeProcedure
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