From 56822dd3b8e343a16c86960cffbaa6e48f363a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Sat, 18 Dec 2021 22:36:11 +0100 Subject: Docs: Tips touchup --- book/en/src/by-example/tips_static_lifetimes.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'book/en/src/by-example/tips_static_lifetimes.md') 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}} -- cgit v1.2.3