diff options
| -rw-r--r-- | docs/modules/ROOT/pages/best_practices.adoc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/docs/modules/ROOT/pages/best_practices.adoc b/docs/modules/ROOT/pages/best_practices.adoc index 1e02f9ba9..bfcedec06 100644 --- a/docs/modules/ROOT/pages/best_practices.adoc +++ b/docs/modules/ROOT/pages/best_practices.adoc | |||
| @@ -3,8 +3,10 @@ | |||
| 3 | Over time, a couple of best practices have emerged. The following list should serve as a guideline for developers writing embedded software in _Rust_, especially in the context of the _Embassy_ framework. | 3 | Over time, a couple of best practices have emerged. The following list should serve as a guideline for developers writing embedded software in _Rust_, especially in the context of the _Embassy_ framework. |
| 4 | 4 | ||
| 5 | == Passing Buffers by Reference | 5 | == Passing Buffers by Reference |
| 6 | It may be tempting to pass arrays or wrappers, like link:https://docs.rs/heapless/latest/heapless/[`heapless::Vec`], to a function or return one just like you would with a `std::Vec`. However, in most embedded applications you don't want to spend ressources on an allocator and end up placing buffers on the stack. | 6 | It may be tempting to pass arrays or wrappers, like link:https://docs.rs/heapless/latest/heapless/[`heapless::Vec`], |
| 7 | This, however, can easily blow up your stack if you are not careful. | 7 | to a function or return one just like you would with a `std::Vec`. However, in most embedded applications you don't |
| 8 | want to spend resources on an allocator and end up placing buffers on the stack. This, however, can easily blow up | ||
| 9 | your stack if you are not careful. | ||
| 8 | 10 | ||
| 9 | Consider the following example: | 11 | Consider the following example: |
| 10 | [,rust] | 12 | [,rust] |
