Enable json command in REPL.
This commit is contained in:
parent
9418d7b0c8
commit
75a8a4d4e3
@ -32,7 +32,7 @@ no_float = [] # no floating-point
|
||||
f32_float = [] # set FLOAT=f32
|
||||
only_i32 = [] # set INT=i32 (useful for 32-bit systems)
|
||||
only_i64 = [] # set INT=i64 (default) and disable support for all other integer types
|
||||
decimal = ["rust_decimal/std"] # add the Decimal number type
|
||||
decimal = ["rust_decimal"] # add the Decimal number type
|
||||
no_index = [] # no arrays and indexing
|
||||
no_object = [] # no custom objects
|
||||
no_function = ["no_closure"] # no script-defined functions (meaning no closures)
|
||||
@ -40,7 +40,7 @@ no_closure = [] # no automatic sharing and capture of anonymous
|
||||
no_module = [] # no modules
|
||||
internals = [] # expose internal data structures
|
||||
unicode-xid-ident = ["unicode-xid"] # allow Unicode Standard Annex #31 for identifiers.
|
||||
metadata = ["serde_json", "rhai_codegen/metadata"] # enable exporting functions metadata
|
||||
metadata = ["serde", "serde_json", "rhai_codegen/metadata"] # enable exporting functions metadata
|
||||
|
||||
no_std = ["no-std-compat", "num-traits/libm", "core-error", "libm", "ahash/compile-time-rng"]
|
||||
|
||||
|
@ -6,15 +6,21 @@ This sample application is the same version as the `rhai-repl` tool, compiled fo
|
||||
[`wee_alloc`](https://crates.io/crates/wee_alloc) is used as the allocator.
|
||||
|
||||
|
||||
To Compile
|
||||
----------
|
||||
To Build
|
||||
--------
|
||||
|
||||
The nightly compiler is required:
|
||||
|
||||
```bash
|
||||
cargo +nightly build --release
|
||||
```
|
||||
|
||||
A specific profile can also be used:
|
||||
|
||||
```bash
|
||||
cargo +nightly build --profile unix -Z unstable-options
|
||||
```
|
||||
|
||||
Available profiles are: `unix`, `windows` and `macos`.
|
||||
Three profiles are defined: `unix`, `windows` and `macos`.
|
||||
|
||||
The release build is optimized for size. It can be changed to optimize on speed instead.
|
||||
|
@ -6,15 +6,21 @@ This sample application is a bare-bones `no-std` build for testing.
|
||||
[`wee_alloc`](https://crates.io/crates/wee_alloc) is used as the allocator.
|
||||
|
||||
|
||||
To Compile
|
||||
----------
|
||||
To Build
|
||||
--------
|
||||
|
||||
The nightly compiler is required:
|
||||
|
||||
```bash
|
||||
cargo +nightly build --release
|
||||
```
|
||||
|
||||
A specific profile can also be used:
|
||||
|
||||
```bash
|
||||
cargo +nightly build --profile unix -Z unstable-options
|
||||
```
|
||||
|
||||
Available profiles are: `unix`, `windows` and `macos`.
|
||||
Three profiles are defined: `unix`, `windows` and `macos`.
|
||||
|
||||
The release build is optimized for size. It can be changed to optimize on speed instead.
|
||||
|
@ -48,6 +48,8 @@ fn print_help() {
|
||||
println!("scope => print all variables in the scope");
|
||||
#[cfg(feature = "metadata")]
|
||||
println!("functions => print all functions defined");
|
||||
#[cfg(feature = "metadata")]
|
||||
println!("json => output all functions in JSON format");
|
||||
println!("ast => print the last AST (optimized)");
|
||||
println!("astu => print the last raw, un-optimized AST");
|
||||
println!(r"end a line with '\' to continue to the next line.");
|
||||
@ -247,15 +249,16 @@ fn main() {
|
||||
println!();
|
||||
continue;
|
||||
}
|
||||
// "json" => {
|
||||
// println!(
|
||||
// "{}",
|
||||
// engine
|
||||
// .gen_fn_metadata_with_ast_to_json(&main_ast, true)
|
||||
// .unwrap()
|
||||
// );
|
||||
// continue;
|
||||
// }
|
||||
#[cfg(feature = "metadata")]
|
||||
"json" => {
|
||||
println!(
|
||||
"{}",
|
||||
engine
|
||||
.gen_fn_metadata_with_ast_to_json(&main_ast, true)
|
||||
.unwrap()
|
||||
);
|
||||
continue;
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user