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

@@ -542,7 +542,7 @@ impl SerializeMap for DynamicSerializer {
#[cfg(not(feature = "no_object"))]
{
let key = std::mem::take(&mut self._key)
.take_immutable_string()
.as_immutable_string()
.map_err(|typ| {
EvalAltResult::ErrorMismatchDataType(
"string".into(),
@@ -572,7 +572,7 @@ impl SerializeMap for DynamicSerializer {
#[cfg(not(feature = "no_object"))]
{
let _key: Dynamic = _key.serialize(&mut *self)?;
let _key = _key.take_immutable_string().map_err(|typ| {
let _key = _key.as_immutable_string().map_err(|typ| {
EvalAltResult::ErrorMismatchDataType("string".into(), typ.into(), Position::NONE)
})?;
let _value = _value.serialize(&mut *self)?;