From 1dc2f80eb6cb6ac6d1eaede4169d8cabc51c5e7c Mon Sep 17 00:00:00 2001 From: datdenkikniet Date: Sat, 22 Apr 2023 17:37:15 +0200 Subject: Begin migration guide --- book/en/src/migration/migration_v2.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 book/en/src/migration/migration_v2.md (limited to 'book/en/src/migration/migration_v2.md') diff --git a/book/en/src/migration/migration_v2.md b/book/en/src/migration/migration_v2.md new file mode 100644 index 0000000..071d34c --- /dev/null +++ b/book/en/src/migration/migration_v2.md @@ -0,0 +1,16 @@ +# Migrating from v1.0.x to v2.0.0 + +Migrating a project from RTIC `v1.0.x` to `v2.0.0` involves the following steps: + +1. `v2.0.0` requires [`#![type_alias_impl_trait]`](https://github.com/rust-lang/rust/issues/63063) and Rust Nightly. +2. Migrating from the monotonics included in `v1.0.x` to `rtic-time` and `rtic-monotonics`, replacing `spawn_after`, `spawn_at`. +3. Software tasks are now required to be `async`, and using them correctly. +4. Understanding and using data types provided by `rtic-sync` to solve migration problems. + +If you wish to see a code example of changes required, you can check out [the full example migration page](./migration_v2/complete_example.md). + +## TL;DR +1. Add `#![type_alias_impl_trait]` to your crate, and use `cargo +nightly`. +2. Instead of `spawn_after` and `spawn_at`, you now use the `async` functions `delay`, `delay_until` (and related) with impls provided by `rtic-monotonics`. +3. Software tasks _must_ be `async fn`s now. Not returning from a task is allowed so long as there is an `await` in the task. You can still `lock` shared resources. +4. Use `rtic_sync::Arbiter` to `await` access to a shared resource, and `rtic-channel` to communicate between tasks instead of `spawn`-ing new ones. \ No newline at end of file -- cgit v1.2.3