Use tokens to speed up function name lookup.

This commit is contained in:
Stephen Chung
2022-09-25 23:03:18 +08:00
parent ece522ce2f
commit bf02d040e2
15 changed files with 417 additions and 349 deletions

View File

@@ -668,6 +668,12 @@ mod range_functions {
pub fn is_empty_exclusive(range: &mut ExclusiveRange) -> bool {
range.is_empty()
}
/// Return `true` if the range contains a specified value.
#[rhai_fn(name = "contains")]
pub fn contains_exclusive(range: &mut ExclusiveRange, value: INT) -> bool {
range.contains(&value)
}
/// Return the start of the inclusive range.
#[rhai_fn(get = "start", name = "start", pure)]
pub fn start_inclusive(range: &mut InclusiveRange) -> INT {
@@ -695,4 +701,9 @@ mod range_functions {
pub fn is_empty_inclusive(range: &mut InclusiveRange) -> bool {
range.is_empty()
}
/// Return `true` if the range contains a specified value.
#[rhai_fn(name = "contains")]
pub fn contains_inclusive(range: &mut InclusiveRange, value: INT) -> bool {
range.contains(&value)
}
}