mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
1.3 KiB
1.3 KiB
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:
v2.1.0
works on Rust Stable from 1.75 (recommended), while older versions require anightly
compiler via the use of#![type_alias_impl_trait]
.- Migrating from the monotonics included in
v1.0.x
tortic-time
andrtic-monotonics
, replacingspawn_after
,spawn_at
. - Software tasks are now required to be
async
, and using them correctly. - Understanding and using data types provided by
rtic-sync
.
For a detailed description of the changes, refer to the subchapters.
If you wish to see a code example of changes required, you can check out the full example migration page.
TL;DR (Too Long; Didn't Read)
- Instead of
spawn_after
andspawn_at
, you now use theasync
functionsdelay
,delay_until
(and related) with impls provided byrtic-monotonics
. - Software tasks must be
async fn
s now. Not returning from a task is allowed so long as there is anawait
in the task. You can stilllock
shared resources. - Use
rtic_sync::arbiter::Arbiter
toawait
access to a shared resource, andrtic_sync::channel::Channel
to communicate between tasks instead ofspawn
-ing new ones.