RIOT-OS / rust-riot-wrappers

The `riot-wrappers` crate, which enables high-level access to RIOT from the Rust programming language
13 stars 10 forks source link

Added static_data module #95

Closed derMihai closed 1 month ago

derMihai commented 5 months ago

Contribution

It might be the case that I am re-inventing the wheel, but to this moment, I could find no obvious way of defining mutable data with static storage. This is often required for large data structures that are not possible to allocate on stack (e.g. buffers).

This PR adds a static_data module, a safe wrapper that allows obtaining exactly one mutable reference to static data.

Testing

I tested this on native in a small application, but I could not find a way to successfully run cargo test.

kaspar030 commented 1 month ago

Can https://github.com/embassy-rs/static-cell be re-used?

derMihai commented 1 month ago

Can https://github.com/embassy-rs/static-cell be re-used?

definitely. Hours of looking for exactly that made me write this in the first place. We can close.