Skip to main content

frequenz_microgrid/logical_meter/
formula.rs

1// License: MIT
2// Copyright © 2025 Frequenz Energy-as-a-Service GmbH
3
4//! Formula module for the logical meter.
5
6use async_trait::async_trait;
7mod async_formula;
8pub(crate) mod graph_formula;
9pub(crate) mod graph_formula_provider;
10pub use async_formula::Formula;
11
12use crate::{
13    Error,
14    Sample,
15    quantity::Quantity, //
16};
17use tokio::sync::broadcast;
18
19#[async_trait]
20pub trait FormulaSubscriber: std::fmt::Display + Sync + Send {
21    type QuantityType: Quantity;
22    async fn subscribe(&self) -> Result<broadcast::Receiver<Sample<Self::QuantityType>>, Error>;
23}