The relevant part for you is here. You can see that the authors re-export (pub use
) two different external crates as hal
, depending on the v1
or v2
feature flags.
The authors structured the re-exports this way so that you can always refer to microbit::hal
and microbit::pac
, regardless of which feature you're using.
It looks like the type suggested by VS Code is just wrong though. microbit::nrf52833_hal
is not valid. Are you using the "Rust" extension or rust-analyzer? If you don't know about rust-analyzer, you should switch to it. It's much better than RLS (the "Rust" extension). It will eventually become the official Rust language server as well.
Your more recent issue is unresolvable given your current approach. You can't simultaneously store an instance of the Board
struct while also taking a field of it out. Taking the TIMER0
field out of the Board
invalidates that memory, and Rust won't let you move invalid memory. Once you start to move pieces out of Board
, you can never move Board
itself again.
Instead, you'll need to take the parts you need from Board
and drop the rest. Then you can store those parts somewhere else, like your Application
struct.
I can't say yet whether this is a good approach or not, though. I don't have much information about what you're trying to do.