Restructure code base.
This commit is contained in:
72
src/lib.rs
72
src/lib.rs
@@ -69,33 +69,19 @@ use std::prelude::v1::*;
|
||||
|
||||
// Internal modules
|
||||
|
||||
mod api;
|
||||
mod ast;
|
||||
mod custom_syntax;
|
||||
mod deprecated;
|
||||
mod dynamic;
|
||||
mod engine;
|
||||
mod engine_api;
|
||||
mod engine_settings;
|
||||
mod error;
|
||||
mod error_parsing;
|
||||
mod fn_args;
|
||||
mod fn_builtin;
|
||||
mod fn_call;
|
||||
mod fn_func;
|
||||
mod fn_hash;
|
||||
mod fn_native;
|
||||
mod fn_ptr;
|
||||
mod fn_register;
|
||||
mod immutable_string;
|
||||
mod func;
|
||||
mod module;
|
||||
#[cfg(not(feature = "no_optimize"))]
|
||||
mod optimize;
|
||||
mod optimizer;
|
||||
pub mod packages;
|
||||
mod parse;
|
||||
pub mod plugin;
|
||||
mod scope;
|
||||
mod parser;
|
||||
mod tests;
|
||||
mod token;
|
||||
mod tokenizer;
|
||||
mod types;
|
||||
mod r#unsafe;
|
||||
|
||||
type RhaiResult = Result<Dynamic, Box<EvalAltResult>>;
|
||||
@@ -132,17 +118,18 @@ pub type FLOAT = f32;
|
||||
|
||||
pub use ast::{FnAccess, AST};
|
||||
pub use custom_syntax::Expression;
|
||||
pub use dynamic::Dynamic;
|
||||
pub use engine::{Engine, EvalContext, OP_CONTAINS, OP_EQUALS};
|
||||
pub use error::EvalAltResult;
|
||||
pub use error_parsing::{LexError, ParseError, ParseErrorType};
|
||||
pub use fn_native::NativeCallContext;
|
||||
pub use fn_ptr::FnPtr;
|
||||
pub use fn_register::RegisterNativeFunction;
|
||||
pub use immutable_string::ImmutableString;
|
||||
pub use func::{native::NativeCallContext, register::RegisterNativeFunction};
|
||||
pub use module::{FnNamespace, Module};
|
||||
pub use scope::Scope;
|
||||
pub use token::Position;
|
||||
pub use tokenizer::Position;
|
||||
pub use types::{
|
||||
dynamic::Dynamic,
|
||||
error::EvalAltResult,
|
||||
fn_ptr::FnPtr,
|
||||
immutable_string::ImmutableString,
|
||||
parse_error::{LexError, ParseError, ParseErrorType},
|
||||
scope::Scope,
|
||||
};
|
||||
|
||||
/// An identifier in Rhai. [`SmartString`](https://crates.io/crates/smartstring) is used because most
|
||||
/// identifiers are ASCII and short, fewer than 23 characters, so they can be stored inline.
|
||||
@@ -169,23 +156,22 @@ pub type Identifier = SmartString;
|
||||
pub type Identifier = ImmutableString;
|
||||
|
||||
/// Alias to [`Rc`][std::rc::Rc] or [`Arc`][std::sync::Arc] depending on the `sync` feature flag.
|
||||
pub use fn_native::Shared;
|
||||
pub use func::native::Shared;
|
||||
|
||||
//// Alias to [`RefCell`][std::cell::RefCell] or [`RwLock`][std::sync::RwLock] depending on the `sync` feature flag.
|
||||
pub use fn_native::Locked;
|
||||
/// Alias to [`RefCell`][std::cell::RefCell] or [`RwLock`][std::sync::RwLock] depending on the `sync` feature flag.
|
||||
pub use func::native::Locked;
|
||||
|
||||
pub(crate) use fn_hash::{
|
||||
pub(crate) use func::hashing::{
|
||||
calc_fn_hash, calc_fn_params_hash, calc_qualified_fn_hash, calc_qualified_var_hash,
|
||||
combine_hashes,
|
||||
};
|
||||
|
||||
pub use rhai_codegen::*;
|
||||
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
pub use fn_func::Func;
|
||||
pub use func::plugin;
|
||||
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
pub use fn_args::FuncArgs;
|
||||
pub use func::{args::FuncArgs, func::Func};
|
||||
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
pub use ast::ScriptFnMetadata;
|
||||
@@ -211,28 +197,28 @@ pub use module::resolvers as module_resolvers;
|
||||
pub mod serde;
|
||||
|
||||
#[cfg(not(feature = "no_optimize"))]
|
||||
pub use optimize::OptimizationLevel;
|
||||
pub use optimizer::OptimizationLevel;
|
||||
|
||||
// Expose internal data structures.
|
||||
|
||||
#[cfg(feature = "internals")]
|
||||
#[deprecated = "this type is volatile and may change"]
|
||||
pub use dynamic::{AccessMode, DynamicReadLock, DynamicWriteLock, Variant};
|
||||
pub use types::dynamic::{AccessMode, DynamicReadLock, DynamicWriteLock, Variant};
|
||||
|
||||
// Expose internal data structures.
|
||||
#[cfg(feature = "internals")]
|
||||
#[deprecated = "this function is volatile and may change"]
|
||||
pub use token::{get_next_token, parse_string_literal};
|
||||
pub use tokenizer::{get_next_token, parse_string_literal};
|
||||
|
||||
// Expose internal data structures.
|
||||
#[cfg(feature = "internals")]
|
||||
#[deprecated = "this type is volatile and may change"]
|
||||
pub use token::{
|
||||
pub use tokenizer::{
|
||||
InputStream, MultiInputsStream, Token, TokenIterator, TokenizeState, TokenizerControl,
|
||||
TokenizerControlBlock,
|
||||
};
|
||||
|
||||
#[cfg(feature = "internals")]
|
||||
#[deprecated = "this type is volatile and may change"]
|
||||
pub use parse::{IdentifierBuilder, ParseState};
|
||||
pub use parser::{IdentifierBuilder, ParseState};
|
||||
|
||||
#[cfg(feature = "internals")]
|
||||
#[deprecated = "this type is volatile and may change"]
|
||||
|
Reference in New Issue
Block a user