feat(ranges): add is_empty
function to inclusive/exclusive ranges.
This commit is contained in:
parent
4b3608cedc
commit
1269d4b34d
@ -666,6 +666,11 @@ mod range_functions {
|
|||||||
let _ = range;
|
let _ = range;
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
/// Returns true if the range contains no items.
|
||||||
|
#[rhai_fn(get = "is_empty", name = "is_empty", pure)]
|
||||||
|
pub fn is_empty_exclusive(range: &mut ExclusiveRange) -> bool {
|
||||||
|
range.is_empty()
|
||||||
|
}
|
||||||
/// Return the start of the inclusive range.
|
/// Return the start of the inclusive range.
|
||||||
#[rhai_fn(get = "start", name = "start", pure)]
|
#[rhai_fn(get = "start", name = "start", pure)]
|
||||||
pub fn start_inclusive(range: &mut InclusiveRange) -> INT {
|
pub fn start_inclusive(range: &mut InclusiveRange) -> INT {
|
||||||
@ -688,4 +693,9 @@ mod range_functions {
|
|||||||
let _ = range;
|
let _ = range;
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
/// Returns true if the range contains no items.
|
||||||
|
#[rhai_fn(get = "is_empty", name = "is_empty", pure)]
|
||||||
|
pub fn is_empty_inclusive(range: &mut InclusiveRange) -> bool {
|
||||||
|
range.is_empty()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user