Skip to content

Commit

Permalink
Make AsyncProducer::wait_vacant mutable, bump major version because i…
Browse files Browse the repository at this point in the history
…t's a breaking change
  • Loading branch information
agerasev committed Aug 16, 2024
1 parent 9baf814 commit e806829
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion async/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "async-ringbuf"
version = "0.2.1"
version = "0.3.0"
edition.workspace = true
authors.workspace = true
description = "Async SPSC FIFO ring buffer"
Expand Down
2 changes: 2 additions & 0 deletions async/src/traits/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub trait AsyncConsumer: Consumer {
/// Wait for the buffer to contain at least `count` items or to close.
///
/// In debug mode panics if `count` is greater than buffer capacity.
///
/// The method takes `&mut self` because only single [`WaitOccupiedFuture`] is allowed at a time.
fn wait_occupied(&mut self, count: usize) -> WaitOccupiedFuture<'_, Self> {
debug_assert!(count <= self.capacity().get());
WaitOccupiedFuture {
Expand Down
4 changes: 3 additions & 1 deletion async/src/traits/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ pub trait AsyncProducer: Producer {
/// Wait for the buffer to have at least `count` free places for items or to close.
///
/// In debug mode panics if `count` is greater than buffer capacity.
fn wait_vacant(&self, count: usize) -> WaitVacantFuture<'_, Self> {
///
/// The method takes `&mut self` because only single [`WaitVacantFuture`] is allowed at a time.
fn wait_vacant(&mut self, count: usize) -> WaitVacantFuture<'_, Self> {
debug_assert!(count <= self.capacity().get());
WaitVacantFuture {
owner: self,
Expand Down

0 comments on commit e806829

Please sign in to comment.