bbqueue icon indicating copy to clipboard operation
bbqueue copied to clipboard

WIP heap-allocated BBBuffer

Open tedsta opened this issue 5 years ago • 0 comments

Hi there,

I took a stab at #41 here. What's missing is a bbqueue::heap::FramedProducer and bbqueue::heap::FramedConsumer. Also I'm unsure of how you want to structure the crate in terms of heap vs globally-allocated/stack-allocated.

For heap-allocated framed producer/consumer, here's what I'm thinking:

  • Move framed::FramedProducer and framed::FramedConsumer into common, make them use common::Producer / common::Consumer instead of bbqueue::Producer / bbqueue::Consumer.
  • Export wrapped bbqueue::FramedProducer / bbqueue::FramedConsumer with lifetimes re-added.
  • Export wrapped heap::FramedProducer / heap::FramedConsumer with reference counter for dropping (duplicate heap::Producer / heap::Consumer dropping code.

If you like that plan I can go ahead an implement it.

I split the common code into a separate common module that has Producer<N> and Consumer<N> types without lifetimes. The bbbuffer module exports wrapped Producer<'a, N> and Consumer<'a, N> types with the lifetimes. The heap module exports wrapped Producer<N> and Consumer<N> types that include a reference counter to determine if the underlying ConstBBBuffer should be dropped when the producer/consumer is dropped.

tedsta avatar Jul 25 '20 20:07 tedsta