diff options
| author | Henrik Tjäder <henrik@grepit.se> | 2021-12-18 22:36:11 +0100 |
|---|---|---|
| committer | Henrik Tjäder <henrik@grepit.se> | 2021-12-19 01:33:16 +0100 |
| commit | 56822dd3b8e343a16c86960cffbaa6e48f363a16 (patch) | |
| tree | 2a7c24e6cfd74a71d5a5bd95d2a6db4297cb52a8 /book/en/src/by-example/tips_static_lifetimes.md | |
| parent | a2caef394ce35d4fd8e374193c1ee9705a775fbe (diff) | |
Docs: Tips touchup
Diffstat (limited to 'book/en/src/by-example/tips_static_lifetimes.md')
| -rw-r--r-- | book/en/src/by-example/tips_static_lifetimes.md | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/book/en/src/by-example/tips_static_lifetimes.md b/book/en/src/by-example/tips_static_lifetimes.md index 3ea0816..8d3a832 100644 --- a/book/en/src/by-example/tips_static_lifetimes.md +++ b/book/en/src/by-example/tips_static_lifetimes.md @@ -1,16 +1,16 @@ # 'static super-powers -As discussed earlier `local` resources are given `'static` lifetime in `#[init]` and `#[idle]`, -this can be used to allocate an object and then split it up or give the pre-allocated object to a -task, driver or some other object. -This is very useful when needing to allocate memory for drivers, such as USB drivers, and using -data structures that can be split such as [`heapless::spsc::Queue`]. +In `#[init]` and `#[idle]` `local` resources has `'static` lifetime. -In the following example an [`heapless::spsc::Queue`] is given to two different tasks for lock-free access -to the shared queue. +Useful when pre-allocating and/or splitting resources between tasks, drivers +or some other object. +This comes in handy when drivers, such as USB drivers, need to allocate memory and +when using splittable data structures such as [`heapless::spsc::Queue`]. -[`heapless::spsc::Queue`]: https://docs.rs/heapless/0.7.5/heapless/spsc/struct.Queue.html +In the following example two different tasks share a [`heapless::spsc::Queue`] +for lock-free access to the shared queue. +[`heapless::spsc::Queue`]: https://docs.rs/heapless/0.7.5/heapless/spsc/struct.Queue.html ``` rust {{#include ../../../../examples/static.rs}} |
