Add function for string + char.

This commit is contained in:
Stephen Chung 2021-04-05 00:10:08 +08:00
parent e6ea006ac6
commit 26bb88974a

View File

@ -56,6 +56,10 @@ mod string_functions {
pub fn add_append_str(string1: ImmutableString, string2: ImmutableString) -> ImmutableString { pub fn add_append_str(string1: ImmutableString, string2: ImmutableString) -> ImmutableString {
string1 + string2 string1 + string2
} }
#[rhai_fn(name = "+", name = "append")]
pub fn add_append_char(string: ImmutableString, ch: char) -> ImmutableString {
string + ch
}
#[rhai_fn(name = "+", name = "append")] #[rhai_fn(name = "+", name = "append")]
pub fn add_append_unit(string: ImmutableString, _item: ()) -> ImmutableString { pub fn add_append_unit(string: ImmutableString, _item: ()) -> ImmutableString {