Skip to content

Commit d37172e

Browse files
committed
Project re-org
1 parent d1bae9a commit d37172e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+456
-328
lines changed

Cargo.toml

+6
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@ members = [
88
"crates/rune-wasm",
99
"crates/runestick",
1010
"crates/runestick-macros",
11+
"tests",
12+
"examples",
13+
"benches",
1114
]
1215

1316
exclude = [
1417
"tools/builder",
1518
"tools/site",
1619
"tools/generate",
1720
]
21+
22+
[profile.bench]
23+
lto = false

benches/Cargo.toml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "rune-benches"
3+
version = "0.0.0"
4+
authors = ["John-John Tedro <[email protected]>"]
5+
edition = "2018"
6+
7+
[dependencies]
8+
tokio = { version = "0.2.22", features = ["macros"] }
9+
10+
runestick = { path = "../crates/runestick" }
11+
rune-tests = { path = "../tests", default-features = false }

crates/rune/benches/aoc_2020_1a.rs benches/benches/aoc_2020_1a.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ use test::Bencher;
1111
const INPUT: &str = include_str!("data/aoc_2020_1.txt");
1212

1313
#[bench]
14-
fn aoc_2020_1a(b: &mut Bencher) -> anyhow::Result<()> {
14+
fn aoc_2020_1a(b: &mut Bencher) -> runestick::Result<()> {
1515
let mut data = runestick::Vec::new();
1616

1717
for line in INPUT.split('\n').filter(|s| !s.is_empty()) {
1818
data.push_value(str::parse::<i64>(line)?)?;
1919
}
2020

21-
let vm = rune::rune_vm! {
21+
let vm = rune_tests::rune_vm! {
2222
use std::string;
2323

2424
struct NoSolution;

crates/rune/benches/aoc_2020_1b.rs benches/benches/aoc_2020_1b.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ use test::Bencher;
1111
const INPUT: &str = include_str!("data/aoc_2020_1.txt");
1212

1313
#[bench]
14-
fn aoc_2020_1b(b: &mut Bencher) -> anyhow::Result<()> {
14+
fn aoc_2020_1b(b: &mut Bencher) -> runestick::Result<()> {
1515
let mut data = runestick::Vec::new();
1616

1717
for line in INPUT.split('\n').filter(|s| !s.is_empty()) {
1818
data.push_value(str::parse::<i64>(line)?)?;
1919
}
2020

21-
let vm = rune::rune_vm! {
21+
let vm = rune_tests::rune_vm! {
2222
mod iter {
2323
pub fn all_pairs(data) {
2424
let count = data.len();
File renamed without changes.

book/src/closures.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Below we showcase this, with the help of the `rune_s!` macro from the `testing`
5959
module.
6060

6161
```rust,noplaypen
62-
{{#include ../../crates/rune/examples/call_rune_fn.rs}}
62+
{{#include ../../examples/call_rune_fn.rs}}
6363
```
6464

6565
```text

book/src/field_functions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ The following uses an implementation of `add_assign` which performs checked
8686
addition:
8787

8888
```rust,noplaypen
89-
{{#include ../../crates/rune/examples/checked_add_assign.rs}}
89+
{{#include ../../examples/checked_add_assign.rs}}
9090
```
9191

9292
```text

book/src/functions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ same time it can be harder to reason on what your program will do.
5050
Rune functions can be easily set up and called from Rust.
5151

5252
```rust,noplaypen
53-
{{#include ../../crates/rune/examples/basic_add.rs}}
53+
{{#include ../../examples/basic_add.rs}}
5454
```
5555

5656
```text

book/src/instance_functions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ based on its item. So the hash for the item `Foo::new` will always be the same.
3131
In Rust, we can calculate this hash using the `Hash::type_hash` method:
3232

3333
```rune
34-
{{#include ../../crates/rune/examples/function_hash.rs}}
34+
{{#include ../../examples/function_hash.rs}}
3535
```
3636

3737
```text
@@ -51,7 +51,7 @@ identified as the first argument of the instance function, and must be a type
5151
registered in the module using [`Module::ty`].
5252

5353
```rust,noplaypen
54-
{{#include ../../crates/rune/examples/custom_instance_fn.rs}}
54+
{{#include ../../examples/custom_instance_fn.rs}}
5555
```
5656

5757
```text

book/src/objects.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ always strings, but its value must be specified as the sole type parameter.
4545
Note that the dynamic [`Value`] can be used if the type is unknown.
4646

4747
```rust,noplaypen
48-
{{#include ../../crates/rune/examples/object.rs}}
48+
{{#include ../../examples/object.rs}}
4949
```
5050

5151
```text

book/src/tuples.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ $> cargo run --bin rune -- scripts/book/tuples/tuple_patterns.rn
4545
Tuples are represented externally as [primitive tuple types].
4646

4747
```rust,noplaypen
48-
{{#include ../../crates/rune/examples/tuple.rs}}
48+
{{#include ../../examples/tuple.rs}}
4949
```
5050

5151
```text

book/src/vectors.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Hello
3636
Vectors are represented externally as the standard [`Vec`].
3737

3838
```rust
39-
{{#include ../../crates/rune/examples/vector.rs}}
39+
{{#include ../../examples/vector.rs}}
4040
```
4141

4242
```text
@@ -48,7 +48,7 @@ If you have a vector which has values of non-uniform types, you can use
4848
[`VecTuple`] to deal with them.
4949

5050
```rust
51-
{{#include ../../crates/rune/examples/vec_tuple.rs}}
51+
{{#include ../../examples/vec_tuple.rs}}
5252
```
5353

5454
```text

crates/rune/Cargo.toml

+1-10
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,15 @@ An embeddable dynamic programming language for Rust.
1515
"""
1616

1717
[features]
18-
default = ["diagnostics", "testing"]
18+
default = ["diagnostics"]
1919
diagnostics = ["codespan-reporting"]
20-
testing = ["futures-executor"]
2120

2221
[dependencies]
2322
thiserror = "1.0.20"
2423
log = "0.4.11"
2524
codespan-reporting = {version = "0.9.5", optional = true}
2625
hashbrown = "0.8.2"
2726
num = "0.3.0"
28-
futures-executor = {version = "0.3.5", optional = true}
2927
itoa = "0.4.6"
3028
ryu = "1.0"
3129
smallvec = "1.4.2"
@@ -35,13 +33,6 @@ rune-macros = {version = "0.7.0", path = "../rune-macros"}
3533

3634
[dev-dependencies]
3735
tokio = {version = "0.2.22", features = ["macros"]}
38-
futures-executor = "0.3.5"
39-
anyhow = "1.0.34"
40-
41-
rune-modules = {version = "0.7.0", path = "../rune-modules", features = ["full"]}
4236

4337
[package.metadata.docs.rs]
4438
all-features = true
45-
46-
[profile.bench]
47-
lto = false

crates/rune/src/lib.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
//!
107107
//! #[tokio::main]
108108
//! async fn main() -> Result<(), Box<dyn Error>> {
109-
//! let context = rune_modules::default_context()?;
109+
//! let context = runestick::Context::with_default_modules()?;
110110
//! let options = rune::Options::default();
111111
//!
112112
//! let mut sources = rune::Sources::new();
@@ -194,10 +194,7 @@ mod shared;
194194
mod spanned;
195195
mod worker;
196196

197-
// NB: this has to be defined before the `tests` module, because it's used in
198-
// there.
199-
#[cfg(any(test, feature = "testing"))]
200-
#[macro_use]
197+
#[doc(hidden)]
201198
pub mod testing;
202199

203200
/// Internal collection re-export.

crates/rune/src/load/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ pub struct LoadSourcesError;
4444
/// use std::error::Error;
4545
///
4646
/// # fn main() -> Result<(), Box<dyn Error>> {
47-
/// let context = rune_modules::default_context()?;
47+
/// let context = runestick::Context::with_default_modules()?;
4848
/// let mut options = rune::Options::default();
49+
///
4950
/// let mut sources = rune::Sources::new();
5051
/// sources.insert(Source::new("entry", r#"
5152
/// pub fn main() {

0 commit comments

Comments
 (0)