[oden] The big lifetime removal

It turns out that rust can't really reason about the relationship
between the runtime lifetime and the context lifetime in a way that is
actually usable. This removes the lifetime stuff in favor of reference
counting the runtime itself, via a block that we embed in the
pointer. This, I think, it the least worst option here.
This commit is contained in:
John Doty 2023-06-19 08:28:26 -07:00
parent 898b1fe129
commit 9f808cea31
10 changed files with 269 additions and 312 deletions

View file

@ -16,7 +16,7 @@ pub use runtime::Runtime;
pub use value::{Value, ValueRef, ValueType};
#[derive(Error, Debug)]
pub enum Error<'ctx> {
pub enum Error {
#[error("too many classes have been registered")]
TooManyClasses,
#[error("the specified value is not an instance of the class {0}")]
@ -37,7 +37,7 @@ pub enum Error<'ctx> {
#[error("an error occurred calling a rust function: {0}")]
RustFunctionError(String),
#[error("an exception was thrown during evaluation")]
Exception(Value<'ctx>),
Exception(Value),
}
pub type Result<'ctx, T> = core::result::Result<T, Error<'ctx>>;
pub type ValueResult<'ctx> = core::result::Result<Value<'ctx>, Error<'ctx>>;
pub type Result<T> = core::result::Result<T, Error>;
pub type ValueResult = core::result::Result<Value, Error>;