Move some concat functions to builtin.

This commit is contained in:
Stephen Chung
2020-10-10 22:13:55 +08:00
parent 836b4de925
commit 994e5a4251
4 changed files with 60 additions and 29 deletions

View File

@@ -43,7 +43,7 @@ macro_rules! reg_functions {
}
def_package!(crate:MoreStringPackage:"Additional string utilities, including string building.", lib, {
reg_functions!(lib += basic; INT, bool, char, FnPtr);
reg_functions!(lib += basic; INT, bool, FnPtr);
#[cfg(not(feature = "only_i32"))]
#[cfg(not(feature = "only_i64"))]
@@ -139,15 +139,6 @@ mod string_functions {
s
}
#[rhai_fn(name = "+=")]
pub fn append_char(s: &mut ImmutableString, ch: char) {
*s += ch;
}
#[rhai_fn(name = "+=")]
pub fn append_string(s: &mut ImmutableString, add: ImmutableString) {
*s += &add;
}
#[rhai_fn(name = "len", get = "len")]
pub fn len(s: &str) -> INT {
s.chars().count() as INT