bbqueue
bbqueue copied to clipboard
Better examples/docs
We should have more complete examples for common use cases, including (at least):
- How to use with RTFM
- How to use in bare metal
CC #54 / @justacec
In particular, we should show:
- How to declare a BBBuffer at
static
scope - How to store the Consumer/Producer in RTFM's Resources, or something like
cmim
's Move container - How to store a
GrantR
/GrantW
in anOption<GrantX<'static, U32>>
with RTFM's Resources or something likecmim
's Move container
As a side question; would also be nice to see some examples/docs on how to use this for not just basic bytes, but storing stuff like structs
As a newish Rust programmer, the current example's line static BB: BBBuffer<U6> = BBBuffer( ConstBBBuffer::new() );
was a bit confusing due to the implicit use of generic-array.
@ianrrees I also found the same thing
As a note @maraisr, I don't plan to have BBQueue support non-byte (e.g. arrays of u8
s) data. It does not currently manage things like alignment, so it wouldn't work as a general purpose struct storage item. You could use it with something like serde
or postcard
if you need to send things across the wire.
In the future, I will be removing the Generic Array usage, you can take a peek at the next generation docs if you want to see what that will look like!
This "next gen" branch will be merged when min_const_generics lands in the next release or two.