#[non_exhaustive]pub struct RateComponents {
pub prev_samples: isize,
pub curr_samples: isize,
pub interval: Duration,
pub current_interval_fraction: f64,
}
Expand description
Input struct to custom functions for calculating rate. Includes the counts from the current interval, previous interval, the configured duration of an interval, and the fraction into the current interval that the sample was taken.
Ex. If the interval to the Rate instance is 10s
, and the rate calculation
is taken at 2 seconds after the start of the current interval, then the
fraction of the current interval returned in this struct will be 0.2
meaning 20% of the current interval has elapsed
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.prev_samples: isize
§curr_samples: isize
§interval: Duration
§current_interval_fraction: f64
Trait Implementations§
Source§impl Clone for RateComponents
impl Clone for RateComponents
Source§fn clone(&self) -> RateComponents
fn clone(&self) -> RateComponents
Returns a copy of the value. Read more
1.0.0 · 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 RateComponents
impl Debug for RateComponents
Source§impl PartialEq for RateComponents
impl PartialEq for RateComponents
Source§impl PartialOrd for RateComponents
impl PartialOrd for RateComponents
impl Copy for RateComponents
impl StructuralPartialEq for RateComponents
Auto Trait Implementations§
impl Freeze for RateComponents
impl RefUnwindSafe for RateComponents
impl Send for RateComponents
impl Sync for RateComponents
impl Unpin for RateComponents
impl UnwindSafe for RateComponents
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)