Closed bdarcus closed 1 year ago
Some of the code here is just kind of ugly, mostly because I'm still a newbie with Rust.
In particular, there's a lot of unwrap and such, since I'm defining a lot of the key struct fields as optional.
unwrap
If I change that, hoping to rely on derive default, schemars will requires the fields in the JSON, and I can't figure out how to avoid that.
EDIT: in Hayagriva, the typst folks have the FmtOptionExt<'a> trait, which they implement in such a way they can do stuff like this:
database.citation(&mut formatter, &citations).display.value
In #94, I mostly figured this out.
Some of the code here is just kind of ugly, mostly because I'm still a newbie with Rust.
In particular, there's a lot of
unwrap
and such, since I'm defining a lot of the key struct fields as optional.If I change that, hoping to rely on derive default, schemars will requires the fields in the JSON, and I can't figure out how to avoid that.
EDIT: in Hayagriva, the typst folks have the FmtOptionExt<'a> trait, which they implement in such a way they can do stuff like this: