Converting rust from std to no-std
Things I'm learning (note: using core only, no alloc either)
- String / Vec - std only
- byteorder not easy to use, better to use u32::from_le_bytes / to_le_bytes
- must use references. Make it a pain in the ass. Ended up having a wrapper class to more easily work around
struct<'a> Message<'a> { data: &'a [u8] }
and wrapper
struct ValidMessage {
data: Vec
with Into::into, but really just used my Decoder (which can return &Message) to get a Message
- the underlying memory was owned by the Decoder ; Now that I think of it, I used a stack allocated one,
if I use Box
I might get away somehow
But really annoying that you can't somehow do away with the reference. Box/RefCell something
2 August 2022