1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use super::state::*;
use crate::auto_path::AutoPath;
use crate::base_flow::stat_flow::StatFlowTracer;
use crate::manifest::Binded;

pub struct Gauge {
    tracer: Binded<StatFlowTracer<GaugeSpec>>,
}

impl Gauge {
    // TODO: Use `ms` here and move `realtime` paramter to the rillrate constructor
    pub fn new(auto_path: impl Into<AutoPath>, spec: GaugeSpec) -> Self {
        let path = auto_path.into();
        let tracer = Binded::new(StatFlowTracer::new(path.into(), spec));
        Self { tracer }
    }

    // TODO: Add `new_auto`
    /*
    pub fn new_auto(&str) -> Self;
    */

    pub fn set(&self, value: f64) {
        self.tracer.change(value);
    }
}