diff options
author | 2022-02-10 09:26:59 +0000 | |
---|---|---|
committer | 2022-02-10 09:26:59 +0000 | |
commit | a98058c2a0bafc4f5f53e20538bff1dc57a8c944 (patch) | |
tree | afd13efad9e51d807c507a1e4bbb08884cf6f018 | |
parent | a11cba66d4517ffa60beb0c08588472e04e5a7db (diff) | |
parent | a8a55a3913f66189b0a7e9c501245dbea64101b1 (diff) | |
download | rtic-a98058c2a0bafc4f5f53e20538bff1dc57a8c944.tar.gz rtic-a98058c2a0bafc4f5f53e20538bff1dc57a8c944.tar.zst rtic-a98058c2a0bafc4f5f53e20538bff1dc57a8c944.zip |
Merge #607
607: Docs: Fix dated migration docs for spawn r=korken89 a=AfoHT
Co-authored-by: Henrik Tjäder <henrik@grepit.se>
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | book/en/src/migration/migration_v5.md | 19 |
2 files changed, 14 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d30960b..702d4892 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed +- Fix dated migration docs for spawn - Force mdBook to return error codes - Readded missing ramfunc output to book diff --git a/book/en/src/migration/migration_v5.md b/book/en/src/migration/migration_v5.md index e19fb62f..731931f0 100644 --- a/book/en/src/migration/migration_v5.md +++ b/book/en/src/migration/migration_v5.md @@ -316,11 +316,10 @@ mod app { } ``` -## Spawn/schedule from anywhere - -With the new "spawn/schedule from anywhere", old code such as: - +## Spawn from anywhere +With the new spawn/spawn_after/spawn_at interface, +old code requiring the context `cx` for spawning such as: ``` rust #[task(spawn = [bar])] @@ -344,12 +343,20 @@ fn foo(_c: foo::Context) { #[task] fn bar(_c: bar::Context) { - foo::schedule(/* ... */).unwrap(); + // Takes a Duration, relative to “now” + let spawn_handle = foo::spawn_after(/* ... */); +} + +#[task] +fn bar(_c: bar::Context) { + // Takes an Instant + let spawn_handle = foo::spawn_at(/* ... */); } ``` -Note that the attributes `spawn` and `schedule` are no longer needed. +Thus the requirement of having access to the context is dropped. +Note that the attributes `spawn`/`schedule` in the task definition are no longer needed. --- |