f2b5566c0b
The map visitor for Dynamic was expecting a &str for the key, but the serde_json deserializer internally uses a Cow string, which can be Borrowed or Owned. In the case of Owned, the serde_json key deserializer is calling visit_string on the Visitor, which for &str will result in the error: Error("invalid type: string \"a\", expected a borrowed string", line: 0, column: 0) smartstring actually has its own Visitor implementation that handles both cases, so we can use it instead of an explicit conversion.
99 lines
4.2 KiB
TOML
99 lines
4.2 KiB
TOML
[workspace]
|
|
members = [".", "codegen"]
|
|
|
|
[package]
|
|
name = "rhai"
|
|
version = "1.7.0"
|
|
rust-version = "1.57"
|
|
edition = "2018"
|
|
authors = ["Jonathan Turner", "Lukáš Hozda", "Stephen Chung", "jhwgh1968"]
|
|
description = "Embedded scripting for Rust"
|
|
homepage = "https://rhai.rs"
|
|
repository = "https://github.com/rhaiscript"
|
|
readme = "README.md"
|
|
license = "MIT OR Apache-2.0"
|
|
include = ["**/*.rs", "scripts/*.rhai", "**/*.md", "Cargo.toml"]
|
|
keywords = ["scripting", "scripting-engine", "scripting-language", "embedded"]
|
|
categories = ["no-std", "embedded", "wasm", "parser-implementations"]
|
|
|
|
[dependencies]
|
|
smallvec = { version = "1.7", default-features = false, features = ["union", "const_new" ] }
|
|
ahash = { version = "0.7", default-features = false }
|
|
num-traits = { version = "0.2", default-features = false }
|
|
bitflags = { version = "1", default-features = false }
|
|
smartstring = { version = "1", default-features = false }
|
|
rhai_codegen = { version = "1.4", path = "codegen", default-features = false }
|
|
|
|
no-std-compat = { version = "0.4", default-features = false, features = ["alloc"], optional = true }
|
|
libm = { version = "0.2", default-features = false, optional = true }
|
|
core-error = { version = "0.0", default-features = false, features = ["alloc"], optional = true }
|
|
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"], optional = true }
|
|
serde_json = { version = "1.0", default-features = false, features = ["alloc"], optional = true }
|
|
unicode-xid = { version = "0.2", default-features = false, optional = true }
|
|
rust_decimal = { version = "1.16", default-features = false, features = ["maths"], optional = true }
|
|
rustyline = { version = "9", optional = true }
|
|
|
|
[dev-dependencies]
|
|
serde_bytes = "0.11"
|
|
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
|
|
|
|
[features]
|
|
default = []
|
|
unchecked = [] # unchecked arithmetic
|
|
sync = [] # restrict to only types that implement Send + Sync
|
|
no_position = [] # do not track position in the parser
|
|
no_optimize = [] # no script optimizer
|
|
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"] # 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)
|
|
no_closure = [] # no automatic sharing and capture of anonymous functions to external variables
|
|
no_module = [] # no modules
|
|
unicode-xid-ident = ["unicode-xid"] # allow Unicode Standard Annex #31 for identifiers.
|
|
metadata = ["serde", "serde_json", "rhai_codegen/metadata", "smartstring/serde"] # enable exporting functions metadata
|
|
internals = [] # expose internal data structures
|
|
debugging = ["internals"] # enable debugging
|
|
serde = ["dep:serde", "smartstring/serde"] # implement serde for rhai types
|
|
|
|
# compiling for no-std
|
|
no_std = ["no-std-compat", "num-traits/libm", "core-error", "libm", "ahash/compile-time-rng"]
|
|
|
|
# compiling for WASM
|
|
wasm-bindgen = ["instant/wasm-bindgen"]
|
|
stdweb = ["instant/stdweb"]
|
|
|
|
# compiling bin tools
|
|
bin-features = ["decimal", "metadata", "serde", "debugging", "rustyline"]
|
|
|
|
[[bin]]
|
|
name = "rhai-repl"
|
|
required-features = ["rustyline"]
|
|
|
|
[[bin]]
|
|
name = "rhai-run"
|
|
|
|
[[bin]]
|
|
name = "rhai-dbg"
|
|
required-features = ["debugging"]
|
|
|
|
[profile.release]
|
|
lto = "fat"
|
|
codegen-units = 1
|
|
#opt-level = "z" # optimize for size
|
|
#panic = 'abort' # remove stack backtrace for no-std
|
|
|
|
[target.'cfg(target_family = "wasm")'.dependencies]
|
|
instant = { version = "0.1.10" } # WASM implementation of std::time::Instant
|
|
|
|
[package.metadata.docs.rs]
|
|
features = ["metadata", "serde", "internals", "decimal", "debugging"]
|
|
|
|
[patch.crates-io]
|
|
# Notice that a custom modified version of `rustyline` is used which supports bracketed paste on Windows.
|
|
# This can be moved to the official version when bracketed paste is added.
|
|
rustyline = { git = "https://github.com/schungx/rustyline" }
|