heapless icon indicating copy to clipboard operation
heapless copied to clipboard

Make `Queue::split` `const`.

Open reitermarkus opened this issue 1 year ago • 0 comments

This allows constructing a producer-consumer pair directly in a static, e.g.

static PC: Mutex<RefCell<(Option<Producer<'static, (), 4>>, Option<Consumer<'static, (), 4>>)>> = {
  static mut Q: Queue<(), 4> = Queue::new();
  let (p, c) = unsafe { Q.split() };
  Mutex::new(RefCell::new((Some(p), Some(c))))
};

reitermarkus avatar Jan 21 '24 02:01 reitermarkus