14 lines
411 B
Rust
14 lines
411 B
Rust
|
/// A callable is some object that supports being called.
|
||
|
pub trait Callable {
|
||
|
/// Return the amount of arguments supported by the callable.
|
||
|
fn arity(&self) -> usize;
|
||
|
|
||
|
/// Run the callable in the execution environment with the specified
|
||
|
/// arguments.
|
||
|
fn call(
|
||
|
&self,
|
||
|
environment: &mut Environment,
|
||
|
arguments: &Vec<Value>,
|
||
|
) -> Result<Value, InterpreterError>;
|
||
|
}
|