Impl serialize on TopLevelMap

This commit is contained in:
Clément Renault 2024-09-10 19:32:03 +01:00
parent 04596f3616
commit c1c44a0b81
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -2,13 +2,13 @@ use std::borrow::{Borrow, Cow};
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::fmt; use std::fmt;
use serde::Deserialize; use serde::{Deserialize, Serialize};
use serde_json::value::RawValue; use serde_json::value::RawValue;
#[derive(Deserialize)] #[derive(Deserialize, Serialize)]
pub struct TopLevelMap<'p>(#[serde(borrow)] pub BTreeMap<CowStr<'p>, &'p RawValue>); pub struct TopLevelMap<'p>(#[serde(borrow)] pub BTreeMap<CowStr<'p>, &'p RawValue>);
#[derive(Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash, Clone)] #[derive(Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord, Hash, Clone)]
pub struct CowStr<'p>(#[serde(borrow)] pub Cow<'p, str>); pub struct CowStr<'p>(#[serde(borrow)] pub Cow<'p, str>);
impl fmt::Display for CowStr<'_> { impl fmt::Display for CowStr<'_> {