Deprecate RegisterFn and RegisterResultFn.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#![cfg(not(feature = "no_index"))]
|
||||
use rhai::{Array, Engine, EvalAltResult, RegisterFn, INT};
|
||||
use rhai::{Array, Engine, EvalAltResult, INT};
|
||||
|
||||
#[test]
|
||||
fn test_arrays() -> Result<(), Box<EvalAltResult>> {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#![cfg(not(feature = "no_function"))]
|
||||
use rhai::{Dynamic, Engine, EvalAltResult, FnPtr, Func, FuncArgs, RegisterFn, Scope, INT};
|
||||
use rhai::{Dynamic, Engine, EvalAltResult, FnPtr, Func, FuncArgs, Scope, INT};
|
||||
use std::{any::TypeId, iter::once};
|
||||
|
||||
#[test]
|
||||
@@ -131,7 +131,7 @@ fn test_fn_ptr_raw() -> Result<(), Box<EvalAltResult>> {
|
||||
let value = args[2].clone();
|
||||
let this_ptr = args.get_mut(0).unwrap();
|
||||
|
||||
fp.call_dynamic(context, Some(this_ptr), [value])
|
||||
fp.call_dynamic(&context, Some(this_ptr), [value])
|
||||
},
|
||||
);
|
||||
|
||||
|
@@ -1,7 +1,5 @@
|
||||
#![cfg(not(feature = "no_function"))]
|
||||
use rhai::{
|
||||
Engine, EvalAltResult, FnPtr, NativeCallContext, ParseErrorType, RegisterFn, Scope, INT,
|
||||
};
|
||||
use rhai::{Engine, EvalAltResult, FnPtr, NativeCallContext, ParseErrorType, Scope, INT};
|
||||
use std::any::TypeId;
|
||||
use std::cell::RefCell;
|
||||
use std::mem::take;
|
||||
@@ -20,7 +18,7 @@ fn test_fn_ptr_curry_call() -> Result<(), Box<EvalAltResult>> {
|
||||
&[TypeId::of::<FnPtr>(), TypeId::of::<INT>()],
|
||||
|context, args| {
|
||||
let fn_ptr = std::mem::take(args[0]).cast::<FnPtr>();
|
||||
fn_ptr.call_dynamic(context, None, [std::mem::take(args[1])])
|
||||
fn_ptr.call_dynamic(&context, None, [std::mem::take(args[1])])
|
||||
},
|
||||
);
|
||||
|
||||
@@ -159,7 +157,7 @@ fn test_closures() -> Result<(), Box<EvalAltResult>> {
|
||||
|context, args| {
|
||||
let func = take(args[1]).cast::<FnPtr>();
|
||||
|
||||
func.call_dynamic(context, None, [])
|
||||
func.call_dynamic(&context, None, [])
|
||||
},
|
||||
);
|
||||
|
||||
@@ -343,7 +341,7 @@ fn test_closures_external() -> Result<(), Box<EvalAltResult>> {
|
||||
let context = NativeCallContext::new(&engine, &fn_name, &lib);
|
||||
|
||||
// Closure 'f' captures: the engine, the AST, and the curried function pointer
|
||||
let f = move |x: INT| fn_ptr.call_dynamic(context, None, [x.into()]);
|
||||
let f = move |x: INT| fn_ptr.call_dynamic(&context, None, [x.into()]);
|
||||
|
||||
assert_eq!(f(42)?.take_string(), Ok("hello42".to_string()));
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
use rhai::{Engine, EvalAltResult, ParseErrorType, RegisterFn, Scope, INT};
|
||||
use rhai::{Engine, EvalAltResult, ParseErrorType, Scope, INT};
|
||||
|
||||
#[test]
|
||||
fn test_constant() -> Result<(), Box<EvalAltResult>> {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#![cfg(not(feature = "no_float"))]
|
||||
use rhai::{Engine, EvalAltResult, RegisterFn, FLOAT};
|
||||
use rhai::{Engine, EvalAltResult, FLOAT};
|
||||
|
||||
const EPSILON: FLOAT = 0.000_000_000_1;
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
use rhai::{Engine, EvalAltResult, RegisterFn, INT};
|
||||
use rhai::{Engine, EvalAltResult, INT};
|
||||
|
||||
#[test]
|
||||
fn test_fn_ptr() -> Result<(), Box<EvalAltResult>> {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#![cfg(not(feature = "no_function"))]
|
||||
use rhai::{Engine, EvalAltResult, FnNamespace, Module, ParseErrorType, RegisterFn, INT};
|
||||
use rhai::{Engine, EvalAltResult, FnNamespace, Module, ParseErrorType, INT};
|
||||
|
||||
#[test]
|
||||
fn test_functions() -> Result<(), Box<EvalAltResult>> {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#![cfg(not(feature = "no_object"))]
|
||||
|
||||
use rhai::{Engine, EvalAltResult, ImmutableString, RegisterFn, INT};
|
||||
use rhai::{Engine, EvalAltResult, ImmutableString, INT};
|
||||
|
||||
#[test]
|
||||
fn test_get_set() -> Result<(), Box<EvalAltResult>> {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#![cfg(not(feature = "no_object"))]
|
||||
|
||||
use rhai::{Engine, EvalAltResult, RegisterFn, INT};
|
||||
use rhai::{Engine, EvalAltResult, INT};
|
||||
|
||||
#[test]
|
||||
fn test_method_call() -> Result<(), Box<EvalAltResult>> {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
use rhai::{Engine, EvalAltResult, RegisterFn, INT};
|
||||
use rhai::{Engine, EvalAltResult, INT};
|
||||
|
||||
#[test]
|
||||
fn test_mismatched_op() {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#![cfg(not(feature = "no_optimize"))]
|
||||
|
||||
use rhai::{Engine, EvalAltResult, OptimizationLevel, RegisterFn, INT};
|
||||
use rhai::{Engine, EvalAltResult, OptimizationLevel, INT};
|
||||
|
||||
#[test]
|
||||
fn test_optimizer_run() -> Result<(), Box<EvalAltResult>> {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
use rhai::{Engine, EvalAltResult, RegisterFn, Scope, INT};
|
||||
use rhai::{Engine, EvalAltResult, Scope, INT};
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
#[cfg(not(feature = "only_i32"))]
|
||||
|
@@ -1,5 +1,5 @@
|
||||
///! This test simulates an external command object that is driven by a script.
|
||||
use rhai::{Engine, EvalAltResult, RegisterFn, Scope, INT};
|
||||
use rhai::{Engine, EvalAltResult, Scope, INT};
|
||||
use std::sync::{Arc, Mutex, RwLock};
|
||||
|
||||
/// Simulate a command object.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
use rhai::{Engine, EvalAltResult, ImmutableString, RegisterFn, Scope, INT};
|
||||
use rhai::{Engine, EvalAltResult, ImmutableString, Scope, INT};
|
||||
|
||||
#[test]
|
||||
fn test_string() -> Result<(), Box<EvalAltResult>> {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
use rhai::{Engine, EvalAltResult, LexError, ParseErrorType, RegisterFn, INT};
|
||||
use rhai::{Engine, EvalAltResult, LexError, ParseErrorType, INT};
|
||||
|
||||
#[test]
|
||||
fn test_tokens_disabled() {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
use rhai::{Engine, EvalAltResult, RegisterFn, INT};
|
||||
use rhai::{Engine, EvalAltResult, INT};
|
||||
|
||||
#[test]
|
||||
fn test_type_of() -> Result<(), Box<EvalAltResult>> {
|
||||
|
Reference in New Issue
Block a user