rhai/src/packages/fn_basic.rs

23 lines
596 B
Rust
Raw Normal View History

2020-08-14 12:58:34 +02:00
use crate::plugin::*;
2020-11-16 16:10:14 +01:00
use crate::{def_package, FnPtr};
2020-08-14 12:58:34 +02:00
2020-06-25 12:07:57 +02:00
def_package!(crate:BasicFnPackage:"Basic Fn functions.", lib, {
2020-09-13 16:12:11 +02:00
combine_with_exported_module!(lib, "FnPtr", 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 {
#[rhai_fn(name = "name", get = "name")]
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()
}
2020-10-18 16:10:08 +02:00
#[cfg(not(feature = "no_function"))]
pub mod anonymous {
#[rhai_fn(name = "is_anonymous", get = "is_anonymous")]
pub fn is_anonymous(f: &mut FnPtr) -> bool {
f.is_anonymous()
}
}
}