From 7b8405119b52857574d1816f577234b65fdb1d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 2 Jan 2023 18:19:45 +0100 Subject: [PATCH] Interpreter - CallableRef type alias --- src/interpreter/callable.rs | 5 ++++- src/interpreter/mod.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/interpreter/callable.rs b/src/interpreter/callable.rs index 26a8390..695f300 100644 --- a/src/interpreter/callable.rs +++ b/src/interpreter/callable.rs @@ -1,4 +1,4 @@ -use std::fmt::Debug; +use std::{cell::RefCell, fmt::Debug, rc::Rc}; use crate::errors::InterpreterError; @@ -17,3 +17,6 @@ pub trait Callable: Debug + ToString { arguments: Vec, ) -> Result; } + +/// A reference to a callable. +pub type CallableRef = Rc>; diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index 4041801..d6ed7a1 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -4,7 +4,7 @@ mod interpretable; mod native_fn; mod value; -pub use callable::Callable; +pub use callable::{Callable, CallableRef}; pub use environment::*; pub use interpretable::*; pub use value::*;