struct PendingRequestQueues<K, E, S> {
executions: VecDeque<E>,
suggestions: VecDeque<(K, S)>,
execution_capacity: usize,
suggestion_capacity: usize,
prefer_execution: bool,
}Expand description
Independently bounded execution and suggestion queues.
Suggestions are coalesced by sender and the two queues are drained fairly. This keeps a client producing suggestion traffic from consuming execution capacity or the entire tick budget.
Fields§
§executions: VecDeque<E>§suggestions: VecDeque<(K, S)>§execution_capacity: usize§suggestion_capacity: usize§prefer_execution: boolImplementations§
Source§impl<K: Eq, E, S> PendingRequestQueues<K, E, S>
impl<K: Eq, E, S> PendingRequestQueues<K, E, S>
const fn new(execution_capacity: usize, suggestion_capacity: usize) -> Self
fn submit_execution(&mut self, request: E) -> Result<(), CommandQueueFull>
fn submit_suggestions( &mut self, key: K, request: S, ) -> Result<(), CommandQueueFull>
fn pop_front_where( &mut self, execution_allowed: impl FnMut(&E) -> bool, ) -> Option<PendingRequest<E, S>>
fn pop_allowed_execution( &mut self, execution_allowed: &mut impl FnMut(&E) -> bool, ) -> Option<E>
fn clear(&mut self)
Auto Trait Implementations§
impl<K, E, S> Freeze for PendingRequestQueues<K, E, S>
impl<K, E, S> RefUnwindSafe for PendingRequestQueues<K, E, S>
impl<K, E, S> Send for PendingRequestQueues<K, E, S>
impl<K, E, S> Sync for PendingRequestQueues<K, E, S>
impl<K, E, S> Unpin for PendingRequestQueues<K, E, S>
impl<K, E, S> UnsafeUnpin for PendingRequestQueues<K, E, S>
impl<K, E, S> UnwindSafe for PendingRequestQueues<K, E, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>