metrics_runtime/data/
snapshot.rs1use crate::common::Measurement;
2use metrics_core::Key;
3
4#[derive(Default, Debug)]
6pub struct Snapshot {
7 measurements: Vec<(Key, Measurement)>,
8}
9
10impl Snapshot {
11 pub(crate) fn new(measurements: Vec<(Key, Measurement)>) -> Self {
12 Self { measurements }
13 }
14
15 pub fn len(&self) -> usize {
17 self.measurements.len()
18 }
19
20 pub fn is_empty(&self) -> bool {
22 self.measurements.len() != 0
23 }
24
25 pub fn into_measurements(self) -> Vec<(Key, Measurement)> {
27 self.measurements
28 }
29}