Would transmute be good for this?

I'm wanting to take a struct of integers or enum variants and to convert it into its raw byte representation to be transmitted over DMA (and then to take a DMA-received response and convert it back into its struct representation). I thought that Serde might be good for this, and though I could create a data format for it, it would be fairly limited (e.g. I don't know how I'd serialize tuple/struct enum variants or maps), and serde seems overkill for this. Would transmute be appropriate here?

Sounds like a job for bytemuck.


I didn't know about bytemuck!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.