diff options
author | 2021-04-21 15:25:58 +0200 | |
---|---|---|
committer | 2021-04-21 15:25:58 +0200 | |
commit | cfc97488db01ad09ebb62ab5ed4ea9b8b6f35912 (patch) | |
tree | 0e7bd3f8b1e31935abd60bf4d402f3595a1b1590 | |
parent | 374a1c2add280ba0300474998e40f3712f40e9eb (diff) | |
download | rtic-cfc97488db01ad09ebb62ab5ed4ea9b8b6f35912.tar.gz rtic-cfc97488db01ad09ebb62ab5ed4ea9b8b6f35912.tar.zst rtic-cfc97488db01ad09ebb62ab5ed4ea9b8b6f35912.zip |
book: detail import resolving for 0.6 migration
-rw-r--r-- | book/en/src/migration/migration_v5.md | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/book/en/src/migration/migration_v5.md b/book/en/src/migration/migration_v5.md index 8edefd2d..d56d7ffd 100644 --- a/book/en/src/migration/migration_v5.md +++ b/book/en/src/migration/migration_v5.md @@ -30,7 +30,46 @@ mod app { Now that a regular Rust module is used it means it is possible to have custom user code within that module. -Additionally, it means that `use`-statements for resources etc may be required. +Additionally, it means that `use`-statements for resources used in user +code must be moved inside `mod app`, or be referred to with `super`. For +example, change: + +```rust +use some_crate::some_func; + +#[rtic::app(/* .. */)] +const APP: () = { + fn func() { + some_crate::some_func(); + } +}; +``` + +into + +```rust +#[rtic::app(/* .. */)] +mod app { + use some_crate::some_func; + + fn func() { + some_crate::some_func(); + } +} +``` + +or + +```rust +use some_crate::some_func; + +#[rtic::app(/* .. */)] +mod app { + fn func() { + super::some_crate::some_func(); + } +}; +``` ## Move Dispatchers from `extern "C"` to app arguments. |