Revise strings interning.

This commit is contained in:
Stephen Chung
2022-08-12 16:34:57 +08:00
parent 5ba9b3bd1c
commit cba394d73c
15 changed files with 272 additions and 123 deletions

View File

@@ -75,7 +75,7 @@ mod print_debug_functions {
/// Return the empty string.
#[rhai_fn(name = "print", name = "debug")]
pub fn print_empty_string(ctx: NativeCallContext) -> ImmutableString {
ctx.engine().const_empty_string()
ctx.engine().get_interned_string("")
}
/// Return the `string`.
@@ -121,7 +121,7 @@ mod print_debug_functions {
#[rhai_fn(name = "print", name = "to_string")]
pub fn print_unit(ctx: NativeCallContext, unit: ()) -> ImmutableString {
let _ = unit;
ctx.engine().const_empty_string()
ctx.engine().get_interned_string("")
}
/// Convert the unit into a string in debug format.
#[rhai_fn(name = "debug", name = "to_debug")]