From e51146a98cc7c83ea574d13b4b5d8e7ceeeb004b Mon Sep 17 00:00:00 2001 From: datdenkikniet Date: Sun, 23 Apr 2023 13:22:35 +0200 Subject: Move tips into their own subdir --- book/en/src/by-example/tips_static_lifetimes.md | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 book/en/src/by-example/tips_static_lifetimes.md (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 deleted file mode 100644 index 0eaa59f..0000000 --- a/book/en/src/by-example/tips_static_lifetimes.md +++ /dev/null @@ -1,23 +0,0 @@ -# 'static super-powers - -In `#[init]` and `#[idle]` `local` resources have `'static` lifetime. - -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`]. - -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 ../../../../rtic/examples/static.rs}} -``` - -Running this program produces the expected output. - -``` console -$ cargo run --target thumbv7m-none-eabi --example static -``` - -``` console -{{#include ../../../../rtic/ci/expected/static.run}} -``` -- cgit v1.2.3