Closed limikael closed 1 year ago
I went ahead and did it...
the signature of the render function is render(self:Box<Self>)->Elements
which seems to work...
Here is an example without XML:
https://github.com/limikael/appy/blob/master/examples/noxml/src/main.rs
Currently, apx! macro:
Is syntactic sugar for:
This more or less forces the use of the macro, because the code without the macro looks very ugly. As an alternative, instead of having elements just be functions that take props, they can actually be part of the struct. The way to define an element would then be slightly different. Instead of:
... it would be ...
Then, the
#[component]
macro could actually create a builder. Also it would add the children prop to the struct. (for this reason it cannot be a derive macro, since derive macros cannot modify the struct or add to it). It would now be possible to write:And if it takes children:
And then the XML would just be syntactic sugar for the above.
Advantages:
Disadvantages: