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
//! mimas is a statically typed, embeddable scripting language for Rust.
//!
//! This crate is the front door for host programs: it re-exports the pieces of the pipeline you
//! need and bundles the standard library, so embedding is two lines.
//!
//! ```
//! let mut vm = mimas::compile_source(r#"print("hello from mimas");"#).unwrap();
//! vm.run().unwrap();
//! ```
//!
//! # Sharing Rust with a script
//!
//! Tag an item with [`macro@mimas`] and the script can see it, type-checked like anything native.
//! Structs, enums, free functions, and `impl` blocks all work -- note that an `impl` needs the
//! attribute too, not just the type it belongs to.
//!
//! ```
//! use mimas::mimas;
//!
//! #[mimas]
//! struct User(String);
//!
//! #[mimas]
//! impl User {
//! fn greet(self) -> String {
//! format!("Hello, {}!", self.0)
//! }
//! }
//!
//! let mut vm = mimas::compile_source(r#"print(User("mimas").greet());"#).unwrap();
//! vm.run().unwrap();
//! ```
//!
//! Multi-file projects go through [`compile_files`]. For host state, runtime errors, and the rest
//! of the embedding surface, see the [Extension with Rust](https://mim.as/extension-with-rust.html)
//! guide.
//!
//! # Bevy
//!
//! The `bevy` feature adds [`bevy`], a plugin for running mimas scripts in a Bevy app.
pub use library;
pub use vm;
pub use mimas_bevy as bevy;
pub use ;
pub use ;
pub use ;
/// A host run from its cargo target dir already writes `target/mimas/<binary>.json`. Call this
/// to put the manifest somewhere else, like a copy committed for modders.
///
/// ```no_run
/// let library = mimas::Vm::new().install_library(mimas::library::std);
/// mimas::write_api(&library, "scripts/api.json".as_ref())?;
/// # Ok::<(), std::io::Error>(())
/// ```
pub use write_api;
/// Compiles the given source with mimas's std included.
/// Compiles the given files with mimas's std included. Files should be passed in within a tuple
/// first containing their name then followed by their source.