Interpreter - CallableRef type alias

This commit is contained in:
Emmanuel BENOîT 2023-01-02 18:19:45 +01:00
parent d450f186b4
commit 7b8405119b
2 changed files with 5 additions and 2 deletions

View file

@ -1,4 +1,4 @@
use std::fmt::Debug; use std::{cell::RefCell, fmt::Debug, rc::Rc};
use crate::errors::InterpreterError; use crate::errors::InterpreterError;
@ -17,3 +17,6 @@ pub trait Callable: Debug + ToString {
arguments: Vec<Value>, arguments: Vec<Value>,
) -> Result<Value, InterpreterError>; ) -> Result<Value, InterpreterError>;
} }
/// A reference to a callable.
pub type CallableRef = Rc<RefCell<dyn Callable>>;

View file

@ -4,7 +4,7 @@ mod interpretable;
mod native_fn; mod native_fn;
mod value; mod value;
pub use callable::Callable; pub use callable::{Callable, CallableRef};
pub use environment::*; pub use environment::*;
pub use interpretable::*; pub use interpretable::*;
pub use value::*; pub use value::*;