I have a program that populates a struct and then attempts to pass it by value to my Rust function. What I'm observing, via gdb, is that the Rust function appears to receive the struct (command) by ref, and not by value:
Given that the struct is 8 bytes long, I'm guessing that gcc (arm-gcc) is optimising the call to the static-lib-hosted Rust function. I can declare the struct to be passed by reference, but it'd be great to confirm what's going on and receive some advice.
...where my enum required i32 sizing. What I discovered was that a match expression within my Rust code jumped to an undesirable location causing a fault given that the enum wasn't interpreted correctly. Looking back at the original gdb inspection of the memory that I posted makes it look obvious now, but I suppose my assumption was that repr(C) was sufficient.
Note, I could have used u8 or u16 for sizing also. The EABI spec, "Enumerated Types" elaborates on this, and states that i32 should be generally preferred in order to remain portable, which is particularly fine given the general alignment of struct fields on 32-bit word boundaries.