[oden] Grab my incomplete QuickJS wrapper
This commit is contained in:
parent
aa70df41a3
commit
898b1fe129
114 changed files with 244181 additions and 0 deletions
43
oden-js/src/lib.rs
Normal file
43
oden-js/src/lib.rs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
use thiserror::Error;
|
||||
|
||||
mod atom;
|
||||
mod callback;
|
||||
mod class;
|
||||
mod context;
|
||||
mod conversion;
|
||||
mod runtime;
|
||||
mod value;
|
||||
|
||||
pub use atom::{Atom, AtomRef};
|
||||
pub use class::{Class, ClassID};
|
||||
pub use context::{Context, ContextRef, EvalFlags, EvalType};
|
||||
pub use conversion::*;
|
||||
pub use runtime::Runtime;
|
||||
pub use value::{Value, ValueRef, ValueType};
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum Error<'ctx> {
|
||||
#[error("too many classes have been registered")]
|
||||
TooManyClasses,
|
||||
#[error("the specified value is not an instance of the class {0}")]
|
||||
WrongClass(String),
|
||||
#[error("input script contained an embedded NUL byte")]
|
||||
UnexpectedNul,
|
||||
#[error("the target context is from a different runtime")]
|
||||
DifferentRuntime,
|
||||
#[error("the specified value had the wrong type (expected {expected:?}, found {found:?})")]
|
||||
InvalidType {
|
||||
expected: ValueType,
|
||||
found: ValueType,
|
||||
},
|
||||
#[error("argument count mismatch, expected {expected} but received {received}")]
|
||||
ArgumentCountMismatch { expected: usize, received: usize },
|
||||
#[error("a conversion error occurred: {0}")]
|
||||
ConversionError(String),
|
||||
#[error("an error occurred calling a rust function: {0}")]
|
||||
RustFunctionError(String),
|
||||
#[error("an exception was thrown during evaluation")]
|
||||
Exception(Value<'ctx>),
|
||||
}
|
||||
pub type Result<'ctx, T> = core::result::Result<T, Error<'ctx>>;
|
||||
pub type ValueResult<'ctx> = core::result::Result<Value<'ctx>, Error<'ctx>>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue