Fix no_function build.

This commit is contained in:
Stephen Chung 2020-11-16 23:25:19 +08:00
parent 699220057f
commit 7ef3bd6b20
6 changed files with 15 additions and 13 deletions

View File

@ -4,8 +4,8 @@
#![allow(non_snake_case)]
use crate::dynamic::Variant;
use crate::{Engine, EvalAltResult, ParseError, Scope, AST};
use crate::stdlib::{boxed::Box, string::ToString};
use crate::{Engine, EvalAltResult, ParseError, Scope, AST};
/// Trait to create a Rust closure from a script.
pub trait Func<ARGS, RET> {

View File

@ -1,13 +1,13 @@
//! Module defining interfaces to native-Rust functions.
use crate::ast::ScriptFnDef;
use crate::ast::{FnAccess, ScriptFnDef};
use crate::engine::Imports;
use crate::plugin::PluginFunction;
use crate::stdlib::{boxed::Box, convert::TryFrom, fmt, iter::empty, mem, string::String};
use crate::token::is_valid_identifier;
use crate::{
calc_script_fn_hash, Dynamic, Engine, EvalAltResult, EvalContext, FnAccess, ImmutableString,
Module, StaticVec, NO_POS,
calc_script_fn_hash, Dynamic, Engine, EvalAltResult, EvalContext, ImmutableString, Module,
StaticVec, NO_POS,
};
#[cfg(not(feature = "sync"))]

View File

@ -2,11 +2,12 @@
#![allow(non_snake_case)]
use crate::ast::FnAccess;
use crate::dynamic::{DynamicWriteLock, Variant};
use crate::fn_native::{CallableFunction, FnAny, FnCallArgs, SendSync};
use crate::r#unsafe::unsafe_cast_box;
use crate::stdlib::{any::TypeId, boxed::Box, mem, string::String};
use crate::{Dynamic, Engine, EvalAltResult, FnAccess, ImmutableString, NativeCallContext};
use crate::{Dynamic, Engine, EvalAltResult, ImmutableString, NativeCallContext};
/// Trait to register custom functions with the `Engine`.
pub trait RegisterFn<FN, ARGS, RET> {

View File

@ -1,6 +1,6 @@
//! Module defining external-loaded modules for Rhai.
use crate::ast::IdentX;
use crate::ast::{FnAccess, IdentX};
use crate::dynamic::Variant;
use crate::fn_native::{
shared_make_mut, shared_take_or_clone, CallableFunction, FnCallArgs, IteratorFn, SendSync,
@ -20,7 +20,7 @@ use crate::stdlib::{
use crate::token::Token;
use crate::utils::StraightHasherBuilder;
use crate::{
Dynamic, EvalAltResult, FnAccess, ImmutableString, NativeCallContext, Shared, StaticVec, NO_POS,
Dynamic, EvalAltResult, ImmutableString, NativeCallContext, Shared, StaticVec, NO_POS,
};
#[cfg(not(feature = "no_index"))]

View File

@ -2370,9 +2370,9 @@ fn parse_stmt(
Token::Fn | Token::Private => {
let access = if matches!(token, Token::Private) {
eat_token(input, Token::Private);
crate::FnAccess::Private
crate::ast::FnAccess::Private
} else {
crate::FnAccess::Public
crate::ast::FnAccess::Public
};
match input.next().unwrap() {
@ -2553,7 +2553,7 @@ fn parse_fn(
input: &mut TokenStream,
state: &mut ParseState,
lib: &mut FunctionsLib,
access: crate::FnAccess,
access: crate::ast::FnAccess,
mut settings: ParseSettings,
) -> Result<ScriptFnDef, ParseError> {
#[cfg(not(feature = "unchecked"))]
@ -2788,7 +2788,7 @@ fn parse_anon_fn(
// Define the function
let script = ScriptFnDef {
name: fn_name.clone(),
access: crate::FnAccess::Public,
access: crate::ast::FnAccess::Public,
params,
#[cfg(not(feature = "no_closure"))]
externals: Default::default(),

View File

@ -1,10 +1,11 @@
//! Module defining macros for developing _plugins_.
pub use crate::ast::FnAccess;
pub use crate::fn_native::{CallableFunction, FnCallArgs};
pub use crate::stdlib::{any::TypeId, boxed::Box, format, mem, string::ToString, vec as new_vec};
pub use crate::{
Dynamic, Engine, EvalAltResult, FnAccess, ImmutableString, Module, NativeCallContext,
RegisterFn, RegisterResultFn,
Dynamic, Engine, EvalAltResult, ImmutableString, Module, NativeCallContext, RegisterFn,
RegisterResultFn,
};
#[cfg(not(features = "no_module"))]