Use no-std-compat to build no-std.

This commit is contained in:
Stephen Chung
2021-04-17 15:15:54 +08:00
parent 2f2b7403cb
commit 01f0cc028b
48 changed files with 293 additions and 293 deletions

View File

@@ -61,6 +61,12 @@
#[cfg(feature = "no_std")]
extern crate alloc;
#[cfg(feature = "no_std")]
extern crate no_std_compat as std;
#[cfg(feature = "no_std")]
use std::prelude::v1::*;
// Internal modules
mod ast;
@@ -82,13 +88,12 @@ mod parser;
pub mod plugin;
mod result;
mod scope;
mod stdlib;
mod syntax;
mod token;
mod r#unsafe;
mod utils;
type RhaiResult = stdlib::result::Result<Dynamic, stdlib::boxed::Box<EvalAltResult>>;
type RhaiResult = Result<Dynamic, Box<EvalAltResult>>;
/// The system integer type. It is defined as [`i64`].
///
@@ -180,12 +185,12 @@ pub use ast::ScriptFnMetadata;
/// Variable-sized array of [`Dynamic`] values.
/// Not available under `no_index`.
#[cfg(not(feature = "no_index"))]
pub type Array = stdlib::vec::Vec<Dynamic>;
pub type Array = Vec<Dynamic>;
/// Hash map of [`Dynamic`] values with [`ImmutableString`] keys.
/// Not available under `no_object`.
#[cfg(not(feature = "no_object"))]
pub type Map = stdlib::collections::BTreeMap<Identifier, Dynamic>;
pub type Map = std::collections::BTreeMap<Identifier, Dynamic>;
#[cfg(not(feature = "no_module"))]
pub use module::ModuleResolver;