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-21 15:48:45 +02:00
|
|
|
lib.combine_flatten(exported_module!(fn_ptr_functions));
|
2020-06-25 12:07:57 +02:00
|
|
|
});
|
2020-08-16 17:41:59 +02:00
|
|
|
|
2020-08-20 16:11:41 +02:00
|
|
|
#[export_module]
|
|
|
|
mod fn_ptr_functions {
|
|
|
|
#[inline(always)]
|
2020-08-24 04:38:15 +02:00
|
|
|
pub fn name(f: &mut FnPtr) -> ImmutableString {
|
2020-08-20 16:11:41 +02:00
|
|
|
f.get_fn_name().clone()
|
|
|
|
}
|
|
|
|
|
|
|
|
#[rhai_fn(get = "name")]
|
|
|
|
#[inline(always)]
|
2020-08-24 04:38:15 +02:00
|
|
|
pub fn name_prop(f: &mut FnPtr) -> ImmutableString {
|
2020-08-20 16:11:41 +02:00
|
|
|
name(f)
|
|
|
|
}
|
2020-08-16 17:41:59 +02:00
|
|
|
}
|