Refactor function signatures to use slices
This commit is contained in:
+5
-2
@@ -204,9 +204,12 @@ pub enum Purity {
|
||||
Pure,
|
||||
}
|
||||
|
||||
pub type NativeFn = dyn Fn(&[Value]) -> Value;
|
||||
pub type PipeFn = dyn FnMut(&[Value]) -> Value;
|
||||
|
||||
/// A native host function with metadata.
|
||||
pub struct NativeFunction {
|
||||
pub func: Rc<dyn Fn(Vec<Value>) -> Value>,
|
||||
pub func: Rc<NativeFn>,
|
||||
pub purity: Purity,
|
||||
}
|
||||
|
||||
@@ -503,7 +506,7 @@ impl Value {
|
||||
Value::Record(layout, Rc::new(values))
|
||||
}
|
||||
|
||||
pub fn make_function(purity: Purity, func: impl Fn(Vec<Value>) -> Value + 'static) -> Self {
|
||||
pub fn make_function(purity: Purity, func: impl Fn(&[Value]) -> Value + 'static) -> Self {
|
||||
Value::Function(Rc::new(NativeFunction {
|
||||
func: Rc::new(func),
|
||||
purity,
|
||||
|
||||
Reference in New Issue
Block a user