Try to avoid cloning in Value::object
This commit is contained in:
parent
9ca173f6bf
commit
902c55dade
1 changed files with 2 additions and 2 deletions
|
@ -48,10 +48,10 @@ impl Value {
|
||||||
|
|
||||||
/// Construct an object value.
|
/// Construct an object value.
|
||||||
pub fn object<K>(o: HashMap<K, Value>) -> Value
|
pub fn object<K>(o: HashMap<K, Value>) -> Value
|
||||||
where K: AsRef<str> + Eq + Hash
|
where K: Into<String> + Eq + Hash
|
||||||
{
|
{
|
||||||
Value::Object(
|
Value::Object(
|
||||||
o.into_iter().map(|(k, v)| (k.as_ref().to_owned(), v)).collect()
|
o.into_iter().map(|(k, v)| (k.into(), v)).collect()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue