I've had that ‘good idea’ before, my main advice would be to go via C, and avoid manipulating C++ fields from Rust — use a C helper — but I imagine you figured that out already.
So many cursed gdb sessions…
This is a bonfire demo instance for testing purposes