Urg... JSON.
I know JSON's popular, but it would make a rather crappy syntax for the complexity of this schema.
(I know that's really widespread in the OSS community, and that's a real shame. JSON sucks with its three types.
protos much nicer and better defined. See the C++ test strings...)
I think the right thing to do would be to make the Rust parser produce protos and then you can create/assert equality against them in any language (e.g. Python of the Rust produced data). Protos are nice in that way, they're language independent.
But then we'd back to square one: how do you pass protos back and forth btw Rust and Python without making copies.
And besides, I'm pretty sure you'll prefer the Rust data structures over protos.
So maybe implement an elegant ser/de to some ascii format to/from Rust data structures, as you would with protos.
Then create a binding from Python to accept and parse a string that creates the corresponding Rust data structures.
Then implement a comparator function.
That's all a bunch of work -- none of it is rocket science, but you're really just redoing protos at that point.