pub struct FairQueue<V: FairGroup> { /* private fields */ }Expand description
Spatially distancing fair queue. First in, first out, ensuring that each group of similar values is placed as far apart as possible.
Implementations§
Source§impl<V: FairGroup> FairQueue<V>
impl<V: FairGroup> FairQueue<V>
pub fn new(max_group_size: usize) -> Self
Sourcepub fn can_insert(&self, value: &V) -> bool
pub fn can_insert(&self, value: &V) -> bool
Check if a value can be inserted without exceeding group limits
Sourcepub fn insert(&mut self, value: Arc<V>) -> bool
pub fn insert(&mut self, value: Arc<V>) -> bool
Inserts a new item into the queue, ensuring spatial distancing between items of the same group. Returns true if inserted successfully, false if group is full.
pub fn pop(&mut self) -> Option<Arc<V>>
Auto Trait Implementations§
impl<V> Freeze for FairQueue<V>
impl<V> RefUnwindSafe for FairQueue<V>where
V: RefUnwindSafe,
impl<V> Send for FairQueue<V>
impl<V> Sync for FairQueue<V>
impl<V> Unpin for FairQueue<V>
impl<V> UnwindSafe for FairQueue<V>where
V: RefUnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more