What I want is to draw it, serialise it to some kind of common markup, and then have an API for dealing with events, altering properties, etc. Making sure that API works well with Rust makes sense, but doing the whole thing programmatically doesn't feel like the right model to me.
You should give Dear ImGui (which is mentioned in the article) a try. I was reluctant myself when I discovered it a couple of years ago, but it is such a joy to work with and so "obviously" the right thing on a very basic level that ImGui is now my default choice for writing UI tools (even with the disadvantage of not having a native look and feel).
It's still possible to put a data layer on top of immediate mode UIs, which basically turn a data representation into a sequence of function calls. But I think this would bring event handling back, which defeats the whole idea of an immediate mode UI :)
What I want is to draw it, serialise it to some kind of common markup, and then have an API for dealing with events, altering properties, etc. Making sure that API works well with Rust makes sense, but doing the whole thing programmatically doesn't feel like the right model to me.