jamesmunns / bbqueue

A SPSC, lockless, no_std, thread safe, queue, based on BipBuffers
Apache License 2.0
431 stars 51 forks source link

Improve Documentation RE supported types #85

Open drewm1980 opened 3 years ago

drewm1980 commented 3 years ago

Is BBQueue limited to buffering bytes? If so (and I think it is), it's an important limitation to mention in the top-level README. I somehow made it through the video, the blog post, the readme, and halfway through intergrating bbqueue into my code before I discovered the bound:

impl<'a, N> BBBuffer<N>
where
    N: ArrayLength<u8>,

, figured out where ArrayLength came from, studied the generic_array crate a bit, and realized bbqueue probably isn't what I was looking for. I knew bbqueue was implemented for byte buffer DMA use cases, but I'm so used to containers being generic over the contained type that I mistakenly assumed it.

Thanks! Andrew

jamesmunns commented 3 years ago

Hey Andrew,

For a variety of reasons, bbqueue only handles u8s. This is largely due to the ability to avoid things like alignment or other issues.

If this is a problem, I'd probably suggest checking out heapless's Queue structures (spsc or mpmc).

I'll leave this issue open as a reminder to update the docs to make this more clear!