blob: fbd2626006c525a364972561238ab666c45a2de6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
use crate::value::Primitive;
use crate::VM;
pub type NativeFunctionResult = Result<Primitive, Error>;
pub type NativeFunctionInput = fn(&mut VM, &[Primitive]) -> NativeFunctionResult;
pub enum Error {
InvalidArgument,
Unknown(String),
}
#[allow(clippy::type_complexity)]
pub struct NativeFunction {
pub name: &'static str,
pub function: NativeFunctionInput,
pub arity: u8,
pub returns_value: bool,
pub doc: Option<&'static str>,
}
|