serialize everything

This commit is contained in:
Breval Ferrari 2024-10-31 00:24:37 -04:00
parent 829cb64511
commit a82579dfa5
No known key found for this signature in database
GPG key ID: 6FED68D87C479A59

View file

@ -46,13 +46,13 @@ impl<'de> Deserialize<'de> for Atoms {
Sheet,
}
#[derive(Deserialize, new)]
struct NotesSheet<'a> {
notes: &'a str,
sheet: &'a str,
struct NotesSheet {
notes: String,
sheet: String,
}
struct NotesSheetVisitor;
impl<'de> Visitor<'de> for NotesSheetVisitor {
type Value = NotesSheet<'de>;
type Value = NotesSheet;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
formatter.write_str("a \"notes\" field and a \"sheet\" field")
}
@ -98,7 +98,7 @@ impl<'de> Deserialize<'de> for Atoms {
const FIELDS: &[&str] = &["notes", "sheet"];
let NotesSheet { notes, sheet } =
deserializer.deserialize_struct("NotesSheet", FIELDS, NotesSheetVisitor)?;
many0(flat_atom_parser(notes))(sheet)
let x = many0(flat_atom_parser(&notes))(&sheet)
.map_err(|e| e.to_string())
.map_err(AtomsSerializeError::Parsing)
.map_err(de::Error::custom)
@ -107,7 +107,8 @@ impl<'de> Deserialize<'de> for Atoms {
.map_err(AtomsSerializeError::from)
.map_err(de::Error::custom)
})
.map(Atoms)
.map(Atoms);
x
}
}