Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Queue::split const. #443

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

reitermarkus
Copy link
Member

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 reitermarkus force-pushed the const-split branch 2 times, most recently from db0e134 to fe1cf27 Compare January 21, 2024 02:29
@reitermarkus reitermarkus force-pushed the const-split branch 2 times, most recently from bcf76a5 to af09a22 Compare February 19, 2024 08:21
@reitermarkus reitermarkus requested a review from a team February 19, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant