pub struct ThrottleState {
pub active: usize,
pub queued: usize,
pub total_admitted: u64,
pub total_rejected: u64,
}Expand description
Current load snapshot used by the throttler.
Fields§
§active: usizeNumber of currently running executions.
queued: usizeNumber of executions waiting in the queue.
total_admitted: u64Total number of executions admitted since the throttler was created.
total_rejected: u64Total number of executions rejected / delayed.
Implementations§
Source§impl ThrottleState
impl ThrottleState
Sourcepub fn utilisation(&self, capacity: usize) -> f64
pub fn utilisation(&self, capacity: usize) -> f64
Returns utilisation as a fraction [0.0, 1.0] relative to a capacity.
Sourcepub fn has_capacity(&self, capacity: usize) -> bool
pub fn has_capacity(&self, capacity: usize) -> bool
Returns true if there is room for at least one more execution
given the specified capacity.
Trait Implementations§
Source§impl Clone for ThrottleState
impl Clone for ThrottleState
Source§fn clone(&self) -> ThrottleState
fn clone(&self) -> ThrottleState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ThrottleState
impl Debug for ThrottleState
Source§impl Default for ThrottleState
impl Default for ThrottleState
Source§fn default() -> ThrottleState
fn default() -> ThrottleState
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ThrottleState
impl<'de> Deserialize<'de> for ThrottleState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ThrottleState
Source§impl PartialEq for ThrottleState
impl PartialEq for ThrottleState
Source§impl Serialize for ThrottleState
impl Serialize for ThrottleState
impl StructuralPartialEq for ThrottleState
Auto Trait Implementations§
impl Freeze for ThrottleState
impl RefUnwindSafe for ThrottleState
impl Send for ThrottleState
impl Sync for ThrottleState
impl Unpin for ThrottleState
impl UnsafeUnpin for ThrottleState
impl UnwindSafe for ThrottleState
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.