Open avantgardnerio opened 6 months ago
When attempting to codegen for my xsd representing recursive widgets in a windowing environment, I get:
error[E0072]: recursive types `Grid`, `GridRow`, `Widget` and `WidgetChoice` have infinite size --> src/generated/models.rs:39:1 | 39 | pub struct Grid { | ^^^^^^^^^^^^^^^ 40 | #[yaserde(rename = "children")] 41 | pub children: GridRow, | ------- recursive without indirection ... 55 | pub struct GridRow { | ^^^^^^^^^^^^^^^^^^ 56 | #[yaserde(rename = "child")] 57 | pub child: Widget, | ------ recursive without indirection ... 78 | pub enum WidgetChoice { | ^^^^^^^^^^^^^^^^^^^^^ 79 | Grid(Grid), | ---- recursive without indirection ... 94 | pub struct Widget { | ^^^^^^^^^^^^^^^^^ 95 | #[yaserde(flatten)] 96 | pub widget_choice: WidgetChoice, | ------------ recursive without indirection | help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle | 41 ~ pub children: Box<GridRow>,
I'm happy to start contributing, but a little help on where to get started here would help.
It seems like we would need to generate:
impl YaSerialize for Box<Grid> { ... }
I am by no means suggesting we merge without cleanup, but this fixes the problem:
https://github.com/lumeohq/xsd-parser-rs/pull/165
When attempting to codegen for my xsd representing recursive widgets in a windowing environment, I get:
I'm happy to start contributing, but a little help on where to get started here would help.
It seems like we would need to generate: