1
Fork 0

Replace every Vec in Target(Options) with it's Cow equivalent

This commit is contained in:
Loïc BRANSTETT 2022-03-28 01:08:17 +02:00
parent ccff48f97b
commit ce61d4044d
31 changed files with 117 additions and 53 deletions

View file

@ -2247,6 +2247,15 @@ impl<A: ToJson> ToJson for Vec<A> {
}
}
impl<'a, A: ToJson> ToJson for Cow<'a, [A]>
where
[A]: ToOwned,
{
fn to_json(&self) -> Json {
Json::Array(self.iter().map(|elt| elt.to_json()).collect())
}
}
impl<T: ToString, A: ToJson> ToJson for BTreeMap<T, A> {
fn to_json(&self) -> Json {
let mut d = BTreeMap::new();