diff options
| author | Jorge Aparicio <jorge@japaric.io> | 2019-04-16 21:54:19 +0200 |
|---|---|---|
| committer | Jorge Aparicio <jorge@japaric.io> | 2019-04-21 18:00:22 +0200 |
| commit | e865cbb2e59a95962d7e4d45c31f9ff1e4ba6579 (patch) | |
| tree | 20ee060345b788d3f05c7174672abdead0b935bd /book | |
| parent | c4bad51deb75efc033431be513e264c3247b64cb (diff) | |
book: resources shared with init must also be `Send`
Diffstat (limited to 'book')
| -rw-r--r-- | book/en/src/by-example/types-send-sync.md | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/book/en/src/by-example/types-send-sync.md b/book/en/src/by-example/types-send-sync.md index 8ec62e6..632946b 100644 --- a/book/en/src/by-example/types-send-sync.md +++ b/book/en/src/by-example/types-send-sync.md @@ -44,6 +44,14 @@ send operation where the initial value is sent from `idle`, which has the lowest priority of `0`, to a task with will run with a priority greater than or equal to `1`. Thus all late resources need to implement the `Send` trait. +Sharing a resource with `init` can be used to implement late initialization, see +example below. For that reason, resources shared with `init` must also implement +the `Send` trait. + +``` rust +{{#include ../../../../examples/shared-with-init.rs}} +``` + ## `Sync` Similarly, [`Sync`] is a marker trait for "types for which it is safe to share |
