Change take_string and take_immutable_string to as_XXX.

This commit is contained in:
Stephen Chung
2021-06-10 10:45:44 +08:00
parent a5031969ca
commit 79d9977cd5
11 changed files with 62 additions and 31 deletions

View File

@@ -28,7 +28,7 @@ pub fn print_with_func(
) -> crate::ImmutableString {
match ctx.call_fn_dynamic_raw(fn_name, true, &mut [value]) {
Ok(result) if result.is::<crate::ImmutableString>() => result
.take_immutable_string()
.as_immutable_string()
.expect("never fails as the result is `ImmutableString`"),
Ok(result) => ctx.engine().map_type_name(result.type_name()).into(),
Err(_) => ctx.engine().map_type_name(value.type_name()).into(),