1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! STK, a simple stack-based virtual machine.
//!
//! ## Contributing
//!
//! If you want to help out, there's a number of optimization tasks available in
//! [Future Optimizations][future-optimizations].
//!
//! Create an issue about the optimization you want to work on and communicate that
//! you are working on it.
//!
//! ## Features of stk
//!
//! * [Clean Rust FFI][rust-ffi].
//! * Stack-based C FFI like with Lua (TBD).
//! * Stack frames, allowing for isolation across function calls.
//! * A rust-like reference language called *Rune*.
//!
//! ## Rune Scripts
//!
//! stk comes with a simple scripting language called *Rune*.
//!
//! You can run example scripts through rune-cli:
//!
//! ```bash
//! cargo run -- ./scripts/hello_world.rn
//! ```
//!
//! If you want to see diagnostics of your unit, you can do:
//!
//! ```bash
//! cargo run -- ./scripts/hello_world.rn --dump-unit --trace
//! ```
//!
//! [rust-ffi]: https://github.com/udoprog/stk/blob/master/crates/stk-http/src/lib.rs
//! [future-optimizations]: https://github.com/udoprog/stk/blob/master/FUTURE_OPTIMIZATIONS.md

#![deny(missing_docs)]

mod any;
mod context;
mod value;
mod vm;
#[macro_use]
mod macros;
mod error;
mod hash;
pub mod packages;
mod reflection;
mod serde;
pub mod tls;
pub mod unit;

pub use crate::any::Any;
pub use crate::context::{Context, ContextError, Item, Module};
pub use crate::context::{
    ADD, ADD_ASSIGN, DIV, DIV_ASSIGN, INDEX_GET, INDEX_SET, MUL, MUL_ASSIGN, NEXT, SUB, SUB_ASSIGN,
};
pub use crate::error::{Error, Result};
pub use crate::hash::Hash;
pub use crate::reflection::{
    FromValue, IntoArgs, ReflectValueType, ToValue, UnsafeFromValue, UnsafeToValue,
};
pub use crate::unit::{CompilationUnit, CompilationUnitError};
pub use crate::value::{
    Array, Object, Slot, Unit, Value, ValuePtr, ValueRef, ValueType, ValueTypeInfo,
};
pub use crate::vm::{
    Inst, Mut, Panic, RawMutGuard, RawRefGuard, Ref, StackError, Task, Vm, VmError,
};

mod collections {
    pub use hashbrown::HashMap;
    pub use hashbrown::HashSet;
}