• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by John Dev


11 Jan, 2025

Updated at 26 Jan, 2025

Get 'static &mut[u8] in no_std without unsafe

I have an embassy task that takes an embassy BufferedUart<'a, _>. Embassy tasks require all parameters to have a lifetime of 'static. Because the BufferedUart must have a static lifetime, and the two &mut [u8;_] buffers must have the same lifetime as the BufferedUart, I believe I need static &mut [u8;_] buffers.

I am not sure how to get this in safe rust. I will only use these references in the new() function of the BufferedUart, so I believe there should be a way to prove to the compiler that this is safe.

3 posts - 2 participants

Read full topic