chore: Fix CI errors
Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
parent
4820cece7c
commit
898ff46ac5
|
@ -7,7 +7,7 @@ use crate::sync::atomic::{AtomicUsize, Ordering};
|
|||
use crate::sync::cell::UnsafeCell;
|
||||
#[allow(unused_imports)]
|
||||
use crate::sync::prelude::*;
|
||||
use crate::{busy_wait, PopError, PushError, ForcePushError};
|
||||
use crate::{busy_wait, ForcePushError, PopError, PushError};
|
||||
|
||||
/// A slot in a queue.
|
||||
struct Slot<T> {
|
||||
|
@ -115,9 +115,7 @@ impl<T> Bounded<T> {
|
|||
// SAFETY: We know this is initialized, since it's covered by the current queue.
|
||||
let old = unsafe {
|
||||
slot.value
|
||||
.get()
|
||||
.replace(MaybeUninit::new(value))
|
||||
.assume_init()
|
||||
.with_mut(|slot| slot.replace(MaybeUninit::new(value)).assume_init())
|
||||
};
|
||||
|
||||
// Update the stamp.
|
||||
|
|
24
src/lib.rs
24
src/lib.rs
|
@ -182,36 +182,36 @@ impl<T> ConcurrentQueue<T> {
|
|||
}
|
||||
|
||||
/// Push an element into the queue, potentially displacing another element.
|
||||
///
|
||||
///
|
||||
/// Attempts to push an element into the queue. If the queue is full, one item from the
|
||||
/// queue is replaced with the provided item. The displaced item is returned as `Some(T)`.
|
||||
/// If the queue is closed, an error is returned.
|
||||
///
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
///
|
||||
/// ```
|
||||
/// use concurrent_queue::{ConcurrentQueue, ForcePushError, PushError};
|
||||
///
|
||||
///
|
||||
/// let q = ConcurrentQueue::bounded(3);
|
||||
///
|
||||
///
|
||||
/// // We can push to the queue.
|
||||
/// for i in 1..=3 {
|
||||
/// assert_eq!(q.force_push(i), Ok(None));
|
||||
/// }
|
||||
///
|
||||
///
|
||||
/// // Push errors because the queue is now full.
|
||||
/// assert_eq!(q.push(4), Err(PushError::Full(4)));
|
||||
///
|
||||
///
|
||||
/// // Pushing a new value replaces the old ones.
|
||||
/// assert_eq!(q.force_push(5), Ok(Some(1)));
|
||||
/// assert_eq!(q.force_push(6), Ok(Some(2)));
|
||||
///
|
||||
///
|
||||
/// // Close the queue to stop further pushes.
|
||||
/// q.close();
|
||||
///
|
||||
///
|
||||
/// // Pushing will return an error.
|
||||
/// assert_eq!(q.force_push(7), Err(ForcePushError(7)));
|
||||
///
|
||||
///
|
||||
/// // Popping items will return the force-pushed ones.
|
||||
/// assert_eq!(q.pop(), Ok(3));
|
||||
/// assert_eq!(q.pop(), Ok(5));
|
||||
|
@ -224,8 +224,8 @@ impl<T> ConcurrentQueue<T> {
|
|||
Inner::Unbounded(q) => match q.push(value) {
|
||||
Ok(()) => Ok(None),
|
||||
Err(PushError::Closed(value)) => Err(ForcePushError(value)),
|
||||
Err(PushError::Full(_)) => unreachable!()
|
||||
}
|
||||
Err(PushError::Full(_)) => unreachable!(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::sync::atomic::{AtomicUsize, Ordering};
|
|||
use crate::sync::cell::UnsafeCell;
|
||||
#[allow(unused_imports)]
|
||||
use crate::sync::prelude::*;
|
||||
use crate::{busy_wait, PopError, PushError, ForcePushError};
|
||||
use crate::{busy_wait, ForcePushError, PopError, PushError};
|
||||
|
||||
const LOCKED: usize = 1 << 0;
|
||||
const PUSHED: usize = 1 << 1;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![allow(clippy::bool_assert_comparison)]
|
||||
|
||||
use concurrent_queue::{ConcurrentQueue, PopError, PushError, ForcePushError};
|
||||
use concurrent_queue::{ConcurrentQueue, ForcePushError, PopError, PushError};
|
||||
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
use easy_parallel::Parallel;
|
||||
|
|
Loading…
Reference in New Issue