Add return type to function metadata.
This commit is contained in:
@@ -292,6 +292,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
pub fn token_callable() -> CallableFunction {
|
||||
Token().into()
|
||||
@@ -302,6 +305,9 @@ mod generate_tests {
|
||||
pub fn token_input_types() -> Box<[TypeId]> {
|
||||
Token().input_types()
|
||||
}
|
||||
pub fn token_return_type() -> &'static str {
|
||||
Token().return_type()
|
||||
}
|
||||
pub fn dynamic_result_fn() -> Result<Dynamic, Box<EvalAltResult> > {
|
||||
Ok(Dynamic::from(do_nothing()))
|
||||
}
|
||||
@@ -340,6 +346,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<usize>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
pub fn token_callable() -> CallableFunction {
|
||||
Token().into()
|
||||
@@ -350,6 +359,9 @@ mod generate_tests {
|
||||
pub fn token_input_types() -> Box<[TypeId]> {
|
||||
Token().input_types()
|
||||
}
|
||||
pub fn token_return_type() -> &'static str {
|
||||
Token().return_type()
|
||||
}
|
||||
pub fn dynamic_result_fn(x: usize) -> Result<Dynamic, Box<EvalAltResult> > {
|
||||
Ok(Dynamic::from(do_something(x)))
|
||||
}
|
||||
@@ -388,6 +400,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<usize>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
pub fn token_callable() -> CallableFunction {
|
||||
Token().into()
|
||||
@@ -398,6 +413,9 @@ mod generate_tests {
|
||||
pub fn token_input_types() -> Box<[TypeId]> {
|
||||
Token().input_types()
|
||||
}
|
||||
pub fn token_return_type() -> &'static str {
|
||||
Token().return_type()
|
||||
}
|
||||
pub fn dynamic_result_fn(context: NativeCallContext, x: usize) -> Result<Dynamic, Box<EvalAltResult> > {
|
||||
Ok(Dynamic::from(do_something(context, x)))
|
||||
}
|
||||
@@ -438,6 +456,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"rhai::Dynamic"
|
||||
}
|
||||
}
|
||||
pub fn token_callable() -> CallableFunction {
|
||||
Token().into()
|
||||
@@ -448,6 +469,9 @@ mod generate_tests {
|
||||
pub fn token_input_types() -> Box<[TypeId]> {
|
||||
Token().input_types()
|
||||
}
|
||||
pub fn token_return_type() -> &'static str {
|
||||
Token().return_type()
|
||||
}
|
||||
pub fn dynamic_result_fn() -> Result<Dynamic, Box<EvalAltResult> > {
|
||||
Ok(return_dynamic())
|
||||
}
|
||||
@@ -482,7 +506,10 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<usize>()].into_boxed_slice()
|
||||
}
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let item_fn = syn::parse2::<ExportedFn>(input_tokens).unwrap();
|
||||
@@ -519,6 +546,9 @@ mod generate_tests {
|
||||
new_vec![TypeId::of::<usize>(),
|
||||
TypeId::of::<usize>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"usize"
|
||||
}
|
||||
}
|
||||
pub fn token_callable() -> CallableFunction {
|
||||
Token().into()
|
||||
@@ -529,6 +559,9 @@ mod generate_tests {
|
||||
pub fn token_input_types() -> Box<[TypeId]> {
|
||||
Token().input_types()
|
||||
}
|
||||
pub fn token_return_type() -> &'static str {
|
||||
Token().return_type()
|
||||
}
|
||||
pub fn dynamic_result_fn(x: usize, y: usize) -> Result<Dynamic, Box<EvalAltResult> > {
|
||||
Ok(Dynamic::from(add_together(x, y)))
|
||||
}
|
||||
@@ -569,6 +602,9 @@ mod generate_tests {
|
||||
new_vec![TypeId::of::<usize>(),
|
||||
TypeId::of::<usize>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
pub fn token_callable() -> CallableFunction {
|
||||
Token().into()
|
||||
@@ -579,6 +615,9 @@ mod generate_tests {
|
||||
pub fn token_input_types() -> Box<[TypeId]> {
|
||||
Token().input_types()
|
||||
}
|
||||
pub fn token_return_type() -> &'static str {
|
||||
Token().return_type()
|
||||
}
|
||||
pub fn dynamic_result_fn(x: &mut usize, y: usize) -> Result<Dynamic, Box<EvalAltResult> > {
|
||||
Ok(Dynamic::from(increment(x, y)))
|
||||
}
|
||||
@@ -618,6 +657,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<ImmutableString>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
pub fn token_callable() -> CallableFunction {
|
||||
Token().into()
|
||||
@@ -628,6 +670,9 @@ mod generate_tests {
|
||||
pub fn token_input_types() -> Box<[TypeId]> {
|
||||
Token().input_types()
|
||||
}
|
||||
pub fn token_return_type() -> &'static str {
|
||||
Token().return_type()
|
||||
}
|
||||
pub fn dynamic_result_fn(message: &str) -> Result<Dynamic, Box<EvalAltResult> > {
|
||||
Ok(Dynamic::from(special_print(message)))
|
||||
}
|
||||
|
@@ -297,7 +297,7 @@ mod generate_tests {
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("get_mystic_number", FnNamespace::Internal, FnAccess::Public, Some(&[]), &[],
|
||||
m.set_fn("get_mystic_number", FnNamespace::Internal, FnAccess::Public, Some(&["INT"]), &[],
|
||||
get_mystic_number_token().into());
|
||||
if flatten {} else {}
|
||||
}
|
||||
@@ -321,6 +321,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"INT"
|
||||
}
|
||||
}
|
||||
pub fn get_mystic_number_token_callable() -> CallableFunction {
|
||||
get_mystic_number_token().into()
|
||||
@@ -331,6 +334,9 @@ mod generate_tests {
|
||||
pub fn get_mystic_number_token_input_types() -> Box<[TypeId]> {
|
||||
get_mystic_number_token().input_types()
|
||||
}
|
||||
pub fn get_mystic_number_token_return_type() -> &'static str {
|
||||
get_mystic_number_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -365,7 +371,7 @@ mod generate_tests {
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("add_one_to", FnNamespace::Global, FnAccess::Public, Some(&["x: INT"]), &[core::any::TypeId::of::<INT>()],
|
||||
m.set_fn("add_one_to", FnNamespace::Global, FnAccess::Public, Some(&["x: INT", "INT"]), &[core::any::TypeId::of::<INT>()],
|
||||
add_one_to_token().into());
|
||||
if flatten {} else {}
|
||||
}
|
||||
@@ -390,6 +396,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<INT>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"INT"
|
||||
}
|
||||
}
|
||||
pub fn add_one_to_token_callable() -> CallableFunction {
|
||||
add_one_to_token().into()
|
||||
@@ -400,6 +409,9 @@ mod generate_tests {
|
||||
pub fn add_one_to_token_input_types() -> Box<[TypeId]> {
|
||||
add_one_to_token().input_types()
|
||||
}
|
||||
pub fn add_one_to_token_return_type() -> &'static str {
|
||||
add_one_to_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -433,7 +445,7 @@ mod generate_tests {
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("add_one_to", FnNamespace::Internal, FnAccess::Public, Some(&["x: INT"]), &[core::any::TypeId::of::<INT>()],
|
||||
m.set_fn("add_one_to", FnNamespace::Internal, FnAccess::Public, Some(&["x: INT", "INT"]), &[core::any::TypeId::of::<INT>()],
|
||||
add_one_to_token().into());
|
||||
if flatten {} else {}
|
||||
}
|
||||
@@ -458,6 +470,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<INT>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"INT"
|
||||
}
|
||||
}
|
||||
pub fn add_one_to_token_callable() -> CallableFunction {
|
||||
add_one_to_token().into()
|
||||
@@ -468,6 +483,9 @@ mod generate_tests {
|
||||
pub fn add_one_to_token_input_types() -> Box<[TypeId]> {
|
||||
add_one_to_token().input_types()
|
||||
}
|
||||
pub fn add_one_to_token_return_type() -> &'static str {
|
||||
add_one_to_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -512,9 +530,9 @@ mod generate_tests {
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("add_n", FnNamespace::Internal, FnAccess::Public, Some(&["x: INT"]), &[core::any::TypeId::of::<INT>()],
|
||||
m.set_fn("add_n", FnNamespace::Internal, FnAccess::Public, Some(&["x: INT", "INT"]), &[core::any::TypeId::of::<INT>()],
|
||||
add_one_to_token().into());
|
||||
m.set_fn("add_n", FnNamespace::Internal, FnAccess::Public, Some(&["x: INT", "y: INT"]),
|
||||
m.set_fn("add_n", FnNamespace::Internal, FnAccess::Public, Some(&["x: INT", "y: INT", "INT"]),
|
||||
&[core::any::TypeId::of::<INT>(), core::any::TypeId::of::<INT>()],
|
||||
add_n_to_token().into());
|
||||
if flatten {} else {}
|
||||
@@ -540,6 +558,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<INT>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"INT"
|
||||
}
|
||||
}
|
||||
pub fn add_one_to_token_callable() -> CallableFunction {
|
||||
add_one_to_token().into()
|
||||
@@ -550,6 +571,9 @@ mod generate_tests {
|
||||
pub fn add_one_to_token_input_types() -> Box<[TypeId]> {
|
||||
add_one_to_token().input_types()
|
||||
}
|
||||
pub fn add_one_to_token_return_type() -> &'static str {
|
||||
add_one_to_token().return_type()
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
struct add_n_to_token();
|
||||
@@ -574,6 +598,9 @@ mod generate_tests {
|
||||
new_vec![TypeId::of::<INT>(),
|
||||
TypeId::of::<INT>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"INT"
|
||||
}
|
||||
}
|
||||
pub fn add_n_to_token_callable() -> CallableFunction {
|
||||
add_n_to_token().into()
|
||||
@@ -584,6 +611,9 @@ mod generate_tests {
|
||||
pub fn add_n_to_token_input_types() -> Box<[TypeId]> {
|
||||
add_n_to_token().input_types()
|
||||
}
|
||||
pub fn add_n_to_token_return_type() -> &'static str {
|
||||
add_n_to_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -617,7 +647,7 @@ mod generate_tests {
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("add_together", FnNamespace::Internal, FnAccess::Public, Some(&["x: INT", "y: INT"]),
|
||||
m.set_fn("add_together", FnNamespace::Internal, FnAccess::Public, Some(&["x: INT", "y: INT", "INT"]),
|
||||
&[core::any::TypeId::of::<INT>(), core::any::TypeId::of::<INT>()],
|
||||
add_together_token().into());
|
||||
if flatten {} else {}
|
||||
@@ -645,6 +675,9 @@ mod generate_tests {
|
||||
new_vec![TypeId::of::<INT>(),
|
||||
TypeId::of::<INT>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"INT"
|
||||
}
|
||||
}
|
||||
pub fn add_together_token_callable() -> CallableFunction {
|
||||
add_together_token().into()
|
||||
@@ -655,6 +688,9 @@ mod generate_tests {
|
||||
pub fn add_together_token_input_types() -> Box<[TypeId]> {
|
||||
add_together_token().input_types()
|
||||
}
|
||||
pub fn add_together_token_return_type() -> &'static str {
|
||||
add_together_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -689,13 +725,13 @@ mod generate_tests {
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("add", FnNamespace::Internal, FnAccess::Public, Some(&["x: INT", "y: INT"]),
|
||||
m.set_fn("add", FnNamespace::Internal, FnAccess::Public, Some(&["x: INT", "y: INT", "INT"]),
|
||||
&[core::any::TypeId::of::<INT>(), core::any::TypeId::of::<INT>()],
|
||||
add_together_token().into());
|
||||
m.set_fn("+", FnNamespace::Internal, FnAccess::Public, Some(&["x: INT", "y: INT"]),
|
||||
m.set_fn("+", FnNamespace::Internal, FnAccess::Public, Some(&["x: INT", "y: INT", "INT"]),
|
||||
&[core::any::TypeId::of::<INT>(), core::any::TypeId::of::<INT>()],
|
||||
add_together_token().into());
|
||||
m.set_fn("add_together", FnNamespace::Internal, FnAccess::Public, Some(&["x: INT", "y: INT"]),
|
||||
m.set_fn("add_together", FnNamespace::Internal, FnAccess::Public, Some(&["x: INT", "y: INT", "INT"]),
|
||||
&[core::any::TypeId::of::<INT>(), core::any::TypeId::of::<INT>()],
|
||||
add_together_token().into());
|
||||
if flatten {} else {}
|
||||
@@ -723,6 +759,9 @@ mod generate_tests {
|
||||
new_vec![TypeId::of::<INT>(),
|
||||
TypeId::of::<INT>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"INT"
|
||||
}
|
||||
}
|
||||
pub fn add_together_token_callable() -> CallableFunction {
|
||||
add_together_token().into()
|
||||
@@ -733,6 +772,9 @@ mod generate_tests {
|
||||
pub fn add_together_token_input_types() -> Box<[TypeId]> {
|
||||
add_together_token().input_types()
|
||||
}
|
||||
pub fn add_together_token_return_type() -> &'static str {
|
||||
add_together_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -948,7 +990,7 @@ mod generate_tests {
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("get_mystic_number", FnNamespace::Internal, FnAccess::Public, Some(&[]), &[],
|
||||
m.set_fn("get_mystic_number", FnNamespace::Internal, FnAccess::Public, Some(&["INT"]), &[],
|
||||
get_mystic_number_token().into());
|
||||
if flatten {} else {}
|
||||
}
|
||||
@@ -972,6 +1014,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"INT"
|
||||
}
|
||||
}
|
||||
pub fn get_mystic_number_token_callable() -> CallableFunction {
|
||||
get_mystic_number_token().into()
|
||||
@@ -982,6 +1027,9 @@ mod generate_tests {
|
||||
pub fn get_mystic_number_token_input_types() -> Box<[TypeId]> {
|
||||
get_mystic_number_token().input_types()
|
||||
}
|
||||
pub fn get_mystic_number_token_return_type() -> &'static str {
|
||||
get_mystic_number_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1047,7 +1095,7 @@ mod generate_tests {
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("print_out_to", FnNamespace::Internal, FnAccess::Public,
|
||||
Some(&["x: &str"]), &[core::any::TypeId::of::<ImmutableString>()],
|
||||
Some(&["x: &str", "()"]), &[core::any::TypeId::of::<ImmutableString>()],
|
||||
print_out_to_token().into());
|
||||
if flatten {} else {}
|
||||
}
|
||||
@@ -1072,6 +1120,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<ImmutableString>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
pub fn print_out_to_token_callable() -> CallableFunction {
|
||||
print_out_to_token().into()
|
||||
@@ -1082,6 +1133,9 @@ mod generate_tests {
|
||||
pub fn print_out_to_token_input_types() -> Box<[TypeId]> {
|
||||
print_out_to_token().input_types()
|
||||
}
|
||||
pub fn print_out_to_token_return_type() -> &'static str {
|
||||
print_out_to_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1116,7 +1170,7 @@ mod generate_tests {
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("print_out_to", FnNamespace::Internal, FnAccess::Public,
|
||||
Some(&["x: String"]), &[core::any::TypeId::of::<ImmutableString>()],
|
||||
Some(&["x: String", "()"]), &[core::any::TypeId::of::<ImmutableString>()],
|
||||
print_out_to_token().into());
|
||||
if flatten {} else {}
|
||||
}
|
||||
@@ -1141,6 +1195,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<ImmutableString>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
pub fn print_out_to_token_callable() -> CallableFunction {
|
||||
print_out_to_token().into()
|
||||
@@ -1151,6 +1208,9 @@ mod generate_tests {
|
||||
pub fn print_out_to_token_input_types() -> Box<[TypeId]> {
|
||||
print_out_to_token().input_types()
|
||||
}
|
||||
pub fn print_out_to_token_return_type() -> &'static str {
|
||||
print_out_to_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1185,7 +1245,7 @@ mod generate_tests {
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("increment", FnNamespace::Internal, FnAccess::Public,
|
||||
Some(&["x: &mut FLOAT"]), &[core::any::TypeId::of::<FLOAT>()],
|
||||
Some(&["x: &mut FLOAT", "()"]), &[core::any::TypeId::of::<FLOAT>()],
|
||||
increment_token().into());
|
||||
if flatten {} else {}
|
||||
}
|
||||
@@ -1210,6 +1270,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<FLOAT>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
pub fn increment_token_callable() -> CallableFunction {
|
||||
increment_token().into()
|
||||
@@ -1220,6 +1283,9 @@ mod generate_tests {
|
||||
pub fn increment_token_input_types() -> Box<[TypeId]> {
|
||||
increment_token().input_types()
|
||||
}
|
||||
pub fn increment_token_return_type() -> &'static str {
|
||||
increment_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1257,7 +1323,7 @@ mod generate_tests {
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("increment", FnNamespace::Internal, FnAccess::Public,
|
||||
Some(&["x: &mut FLOAT"]), &[core::any::TypeId::of::<FLOAT>()],
|
||||
Some(&["x: &mut FLOAT", "()"]), &[core::any::TypeId::of::<FLOAT>()],
|
||||
increment_token().into());
|
||||
if flatten {} else {}
|
||||
}
|
||||
@@ -1282,6 +1348,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<FLOAT>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
pub fn increment_token_callable() -> CallableFunction {
|
||||
increment_token().into()
|
||||
@@ -1292,6 +1361,9 @@ mod generate_tests {
|
||||
pub fn increment_token_input_types() -> Box<[TypeId]> {
|
||||
increment_token().input_types()
|
||||
}
|
||||
pub fn increment_token_return_type() -> &'static str {
|
||||
increment_token().return_type()
|
||||
}
|
||||
}
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
@@ -1350,7 +1422,7 @@ mod generate_tests {
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("increment", FnNamespace::Internal, FnAccess::Public,
|
||||
Some(&["x: &mut FLOAT"]), &[core::any::TypeId::of::<FLOAT>()],
|
||||
Some(&["x: &mut FLOAT", "()"]), &[core::any::TypeId::of::<FLOAT>()],
|
||||
increment_token().into());
|
||||
if flatten {} else {}
|
||||
}
|
||||
@@ -1375,6 +1447,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<FLOAT>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
pub fn increment_token_callable() -> CallableFunction {
|
||||
increment_token().into()
|
||||
@@ -1385,6 +1460,9 @@ mod generate_tests {
|
||||
pub fn increment_token_input_types() -> Box<[TypeId]> {
|
||||
increment_token().input_types()
|
||||
}
|
||||
pub fn increment_token_return_type() -> &'static str {
|
||||
increment_token().return_type()
|
||||
}
|
||||
}
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
@@ -1441,7 +1519,8 @@ mod generate_tests {
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("get$square", FnNamespace::Internal, FnAccess::Public, Some(&["x: &mut u64"]), &[core::any::TypeId::of::<u64>()],
|
||||
m.set_fn("get$square", FnNamespace::Internal, FnAccess::Public, Some(&["x: &mut u64", "u64"]),
|
||||
&[core::any::TypeId::of::<u64>()],
|
||||
int_foo_token().into());
|
||||
if flatten {} else {}
|
||||
}
|
||||
@@ -1466,6 +1545,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<u64>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"u64"
|
||||
}
|
||||
}
|
||||
pub fn int_foo_token_callable() -> CallableFunction {
|
||||
int_foo_token().into()
|
||||
@@ -1476,6 +1558,9 @@ mod generate_tests {
|
||||
pub fn int_foo_token_input_types() -> Box<[TypeId]> {
|
||||
int_foo_token().input_types()
|
||||
}
|
||||
pub fn int_foo_token_return_type() -> &'static str {
|
||||
int_foo_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1510,9 +1595,9 @@ mod generate_tests {
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("square", FnNamespace::Internal, FnAccess::Public, Some(&["x: &mut u64"]), &[core::any::TypeId::of::<u64>()],
|
||||
m.set_fn("square", FnNamespace::Internal, FnAccess::Public, Some(&["x: &mut u64", "u64"]), &[core::any::TypeId::of::<u64>()],
|
||||
int_foo_token().into());
|
||||
m.set_fn("get$square", FnNamespace::Internal, FnAccess::Public, Some(&["x: &mut u64"]), &[core::any::TypeId::of::<u64>()],
|
||||
m.set_fn("get$square", FnNamespace::Internal, FnAccess::Public, Some(&["x: &mut u64", "u64"]), &[core::any::TypeId::of::<u64>()],
|
||||
int_foo_token().into());
|
||||
if flatten {} else {}
|
||||
}
|
||||
@@ -1537,6 +1622,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<u64>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"u64"
|
||||
}
|
||||
}
|
||||
pub fn int_foo_token_callable() -> CallableFunction {
|
||||
int_foo_token().into()
|
||||
@@ -1547,6 +1635,9 @@ mod generate_tests {
|
||||
pub fn int_foo_token_input_types() -> Box<[TypeId]> {
|
||||
int_foo_token().input_types()
|
||||
}
|
||||
pub fn int_foo_token_return_type() -> &'static str {
|
||||
int_foo_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1581,7 +1672,7 @@ mod generate_tests {
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("set$squared", FnNamespace::Internal, FnAccess::Public, Some(&["x: &mut u64", "y: u64"]),
|
||||
m.set_fn("set$squared", FnNamespace::Internal, FnAccess::Public, Some(&["x: &mut u64", "y: u64", "()"]),
|
||||
&[core::any::TypeId::of::<u64>(), core::any::TypeId::of::<u64>()],
|
||||
int_foo_token().into());
|
||||
if flatten {} else {}
|
||||
@@ -1608,6 +1699,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<u64>(), TypeId::of::<u64>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
pub fn int_foo_token_callable() -> CallableFunction {
|
||||
int_foo_token().into()
|
||||
@@ -1618,6 +1712,9 @@ mod generate_tests {
|
||||
pub fn int_foo_token_input_types() -> Box<[TypeId]> {
|
||||
int_foo_token().input_types()
|
||||
}
|
||||
pub fn int_foo_token_return_type() -> &'static str {
|
||||
int_foo_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1652,10 +1749,10 @@ mod generate_tests {
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("set_sq", FnNamespace::Internal, FnAccess::Public, Some(&["x: &mut u64", "y: u64"]),
|
||||
m.set_fn("set_sq", FnNamespace::Internal, FnAccess::Public, Some(&["x: &mut u64", "y: u64", "()"]),
|
||||
&[core::any::TypeId::of::<u64>(), core::any::TypeId::of::<u64>()],
|
||||
int_foo_token().into());
|
||||
m.set_fn("set$squared", FnNamespace::Internal, FnAccess::Public, Some(&["x: &mut u64", "y: u64"]),
|
||||
m.set_fn("set$squared", FnNamespace::Internal, FnAccess::Public, Some(&["x: &mut u64", "y: u64", "()"]),
|
||||
&[core::any::TypeId::of::<u64>(), core::any::TypeId::of::<u64>()],
|
||||
int_foo_token().into());
|
||||
if flatten {} else {}
|
||||
@@ -1682,6 +1779,9 @@ mod generate_tests {
|
||||
fn input_types(&self) -> Box<[TypeId]> {
|
||||
new_vec![TypeId::of::<u64>(), TypeId::of::<u64>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
pub fn int_foo_token_callable() -> CallableFunction {
|
||||
int_foo_token().into()
|
||||
@@ -1692,6 +1792,9 @@ mod generate_tests {
|
||||
pub fn int_foo_token_input_types() -> Box<[TypeId]> {
|
||||
int_foo_token().input_types()
|
||||
}
|
||||
pub fn int_foo_token_return_type() -> &'static str {
|
||||
int_foo_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1727,7 +1830,7 @@ mod generate_tests {
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("index$get$", FnNamespace::Internal, FnAccess::Public,
|
||||
Some(&["x: &mut MyCollection", "i: u64"]),
|
||||
Some(&["x: &mut MyCollection", "i: u64", "FLOAT"]),
|
||||
&[core::any::TypeId::of::<MyCollection>(),
|
||||
core::any::TypeId::of::<u64>()],
|
||||
get_by_index_token().into());
|
||||
@@ -1756,6 +1859,9 @@ mod generate_tests {
|
||||
new_vec![TypeId::of::<MyCollection>(),
|
||||
TypeId::of::<u64>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"FLOAT"
|
||||
}
|
||||
}
|
||||
pub fn get_by_index_token_callable() -> CallableFunction {
|
||||
get_by_index_token().into()
|
||||
@@ -1766,6 +1872,9 @@ mod generate_tests {
|
||||
pub fn get_by_index_token_input_types() -> Box<[TypeId]> {
|
||||
get_by_index_token().input_types()
|
||||
}
|
||||
pub fn get_by_index_token_return_type() -> &'static str {
|
||||
get_by_index_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1801,12 +1910,12 @@ mod generate_tests {
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("get", FnNamespace::Internal, FnAccess::Public,
|
||||
Some(&["x: &mut MyCollection", "i: u64"]),
|
||||
Some(&["x: &mut MyCollection", "i: u64", "FLOAT"]),
|
||||
&[core::any::TypeId::of::<MyCollection>(),
|
||||
core::any::TypeId::of::<u64>()],
|
||||
get_by_index_token().into());
|
||||
m.set_fn("index$get$", FnNamespace::Internal, FnAccess::Public,
|
||||
Some(&["x: &mut MyCollection", "i: u64"]),
|
||||
Some(&["x: &mut MyCollection", "i: u64", "FLOAT"]),
|
||||
&[core::any::TypeId::of::<MyCollection>(),
|
||||
core::any::TypeId::of::<u64>()],
|
||||
get_by_index_token().into());
|
||||
@@ -1835,6 +1944,9 @@ mod generate_tests {
|
||||
new_vec![TypeId::of::<MyCollection>(),
|
||||
TypeId::of::<u64>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"FLOAT"
|
||||
}
|
||||
}
|
||||
pub fn get_by_index_token_callable() -> CallableFunction {
|
||||
get_by_index_token().into()
|
||||
@@ -1845,6 +1957,9 @@ mod generate_tests {
|
||||
pub fn get_by_index_token_input_types() -> Box<[TypeId]> {
|
||||
get_by_index_token().input_types()
|
||||
}
|
||||
pub fn get_by_index_token_return_type() -> &'static str {
|
||||
get_by_index_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1880,7 +1995,7 @@ mod generate_tests {
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("index$set$", FnNamespace::Internal, FnAccess::Public,
|
||||
Some(&["x: &mut MyCollection", "i: u64", "item: FLOAT"]),
|
||||
Some(&["x: &mut MyCollection", "i: u64", "item: FLOAT", "()"]),
|
||||
&[core::any::TypeId::of::<MyCollection>(),
|
||||
core::any::TypeId::of::<u64>(),
|
||||
core::any::TypeId::of::<FLOAT>()],
|
||||
@@ -1912,6 +2027,9 @@ mod generate_tests {
|
||||
TypeId::of::<u64>(),
|
||||
TypeId::of::<FLOAT>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
pub fn set_by_index_token_callable() -> CallableFunction {
|
||||
set_by_index_token().into()
|
||||
@@ -1922,6 +2040,9 @@ mod generate_tests {
|
||||
pub fn set_by_index_token_input_types() -> Box<[TypeId]> {
|
||||
set_by_index_token().input_types()
|
||||
}
|
||||
pub fn set_by_index_token_return_type() -> &'static str {
|
||||
set_by_index_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1957,13 +2078,13 @@ mod generate_tests {
|
||||
#[allow(unused_mut)]
|
||||
pub fn rhai_generate_into_module(m: &mut Module, flatten: bool) {
|
||||
m.set_fn("set", FnNamespace::Internal, FnAccess::Public,
|
||||
Some(&["x: &mut MyCollection", "i: u64", "item: FLOAT"]),
|
||||
Some(&["x: &mut MyCollection", "i: u64", "item: FLOAT", "()"]),
|
||||
&[core::any::TypeId::of::<MyCollection>(),
|
||||
core::any::TypeId::of::<u64>(),
|
||||
core::any::TypeId::of::<FLOAT>()],
|
||||
set_by_index_token().into());
|
||||
m.set_fn("index$set$", FnNamespace::Internal, FnAccess::Public,
|
||||
Some(&["x: &mut MyCollection", "i: u64", "item: FLOAT"]),
|
||||
Some(&["x: &mut MyCollection", "i: u64", "item: FLOAT", "()"]),
|
||||
&[core::any::TypeId::of::<MyCollection>(),
|
||||
core::any::TypeId::of::<u64>(),
|
||||
core::any::TypeId::of::<FLOAT>()],
|
||||
@@ -1995,6 +2116,9 @@ mod generate_tests {
|
||||
TypeId::of::<u64>(),
|
||||
TypeId::of::<FLOAT>()].into_boxed_slice()
|
||||
}
|
||||
fn return_type(&self) -> &'static str {
|
||||
"()"
|
||||
}
|
||||
}
|
||||
pub fn set_by_index_token_callable() -> CallableFunction {
|
||||
set_by_index_token().into()
|
||||
@@ -2005,6 +2129,9 @@ mod generate_tests {
|
||||
pub fn set_by_index_token_input_types() -> Box<[TypeId]> {
|
||||
set_by_index_token().input_types()
|
||||
}
|
||||
pub fn set_by_index_token_return_type() -> &'static str {
|
||||
set_by_index_token().return_type()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user