pub struct SampleCollection<T> { /* private fields */ }Implementations§
Source§impl<T> SampleCollection<T>
impl<T> SampleCollection<T>
Sourcepub fn new(samples: Vec<Sample<T>>) -> Result<Self, Error>
pub fn new(samples: Vec<Sample<T>>) -> Result<Self, Error>
Creates a new MetricKindCollection from a vector of metrics
§Errors
Returns an error if there are duplicate LabelSets in the provided
samples.
pub fn get(&self, label: &LabelSet) -> Option<&Measurement<T>>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> Iter<'_, LabelSet, Measurement<T>>
Source§impl SampleCollection<Counter>
impl SampleCollection<Counter>
pub fn increment(&mut self, label_set: &LabelSet, time: DurationSinceUnixEpoch)
pub fn absolute( &mut self, label_set: &LabelSet, value: u64, time: DurationSinceUnixEpoch, )
Source§impl SampleCollection<Gauge>
impl SampleCollection<Gauge>
pub fn set( &mut self, label_set: &LabelSet, value: f64, time: DurationSinceUnixEpoch, )
pub fn increment(&mut self, label_set: &LabelSet, time: DurationSinceUnixEpoch)
pub fn decrement(&mut self, label_set: &LabelSet, time: DurationSinceUnixEpoch)
Trait Implementations§
Source§impl<T: Clone> Clone for SampleCollection<T>
impl<T: Clone> Clone for SampleCollection<T>
Source§fn clone(&self) -> SampleCollection<T>
fn clone(&self) -> SampleCollection<T>
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<T: Debug> Debug for SampleCollection<T>
impl<T: Debug> Debug for SampleCollection<T>
Source§impl<T: Default> Default for SampleCollection<T>
impl<T: Default> Default for SampleCollection<T>
Source§fn default() -> SampleCollection<T>
fn default() -> SampleCollection<T>
Returns the “default value” for a type. Read more
Source§impl<'de, T> Deserialize<'de> for SampleCollection<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for SampleCollection<T>where
T: Deserialize<'de>,
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
Source§impl<T: PartialEq> PartialEq for SampleCollection<T>
impl<T: PartialEq> PartialEq for SampleCollection<T>
Source§fn eq(&self, other: &SampleCollection<T>) -> bool
fn eq(&self, other: &SampleCollection<T>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<T: PrometheusSerializable> PrometheusSerializable for SampleCollection<T>
impl<T: PrometheusSerializable> PrometheusSerializable for SampleCollection<T>
Source§fn to_prometheus(&self) -> String
fn to_prometheus(&self) -> String
Convert the implementing type into a Prometheus exposition format string. Read more
Source§impl<T: Serialize> Serialize for SampleCollection<T>
impl<T: Serialize> Serialize for SampleCollection<T>
impl<T> StructuralPartialEq for SampleCollection<T>
Auto Trait Implementations§
impl<T> Freeze for SampleCollection<T>
impl<T> RefUnwindSafe for SampleCollection<T>where
T: RefUnwindSafe,
impl<T> Send for SampleCollection<T>where
T: Send,
impl<T> Sync for SampleCollection<T>where
T: Sync,
impl<T> Unpin for SampleCollection<T>where
T: Unpin,
impl<T> UnsafeUnpin for SampleCollection<T>
impl<T> UnwindSafe for SampleCollection<T>where
T: UnwindSafe,
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