rhai/src/packages/fn_basic.rs

22 lines
475 B
Rust
Raw Normal View History

2020-06-25 12:07:57 +02:00
use crate::def_package;
use crate::fn_native::FnPtr;
2020-08-14 12:58:34 +02:00
use crate::plugin::*;
2020-06-25 12:07:57 +02:00
def_package!(crate:BasicFnPackage:"Basic Fn functions.", lib, {
2020-08-20 16:11:41 +02:00
lib.combine(exported_module!(fn_ptr_functions));
2020-06-25 12:07:57 +02:00
});
2020-08-20 16:11:41 +02:00
#[export_module]
mod fn_ptr_functions {
#[inline(always)]
fn name(f: &mut FnPtr) -> ImmutableString {
f.get_fn_name().clone()
}
#[rhai_fn(get = "name")]
#[inline(always)]
fn name_prop(f: &mut FnPtr) -> ImmutableString {
name(f)
}
}