While code for a schema with recursion is currently generated, it can not compile.
It can be fixed manually by saving the code with the store_generated_code option and then adding a Box around the compilation issue.
Furthermore a custom YaSerialize and YaDeserialize has to be implemented for every boxed type, because yaserde is not supporting Box currently.
Adding the boxed serialization can be done like this:
impl yaserde::YaDeserialize for Box<BoxedType> {
fn deserialize<R: Read>(reader: &mut yaserde::de::Deserializer<R>) -> Result<Self, String> {
BoxedType::deserialize(reader).map(Box::new)
}
}
impl yaserde::YaSerialize for Box<BoxedType> {
fn serialize<W: Write>(&self, writer: &mut yaserde::ser::Serializer<W>) -> Result<(), String> {
BoxedType::serialize(&self, writer)
}
}
Because I had no usecase for the attribute, I have no code example for the serialization of these.
An automatic wrapping of these types into Box would allow easier use of this crate.