Rename AnonymousFn to Func
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#![cfg(not(feature = "no_function"))]
|
||||
use rhai::{AnonymousFn, Engine, EvalAltResult, ParseErrorType, Scope, INT};
|
||||
use rhai::{Engine, EvalAltResult, Func, ParseErrorType, Scope, INT};
|
||||
|
||||
#[test]
|
||||
fn test_fn() -> Result<(), EvalAltResult> {
|
||||
@@ -62,7 +62,10 @@ fn test_call_fn() -> Result<(), EvalAltResult> {
|
||||
|
||||
#[test]
|
||||
fn test_anonymous_fn() -> Result<(), EvalAltResult> {
|
||||
let calc_func = AnonymousFn::<(INT, INT, INT), INT>::create_from_script(
|
||||
let calc_func: Box<dyn Fn(INT, INT, INT) -> Result<INT, EvalAltResult>> =
|
||||
Engine::new().create_from_script("fn calc() { 42 }", "calc")?;
|
||||
|
||||
let calc_func = Func::<(INT, INT, INT), INT>::create_from_script(
|
||||
Engine::new(),
|
||||
"fn calc(x, y, z) { (x + y) * z }",
|
||||
"calc",
|
||||
|
Reference in New Issue
Block a user