pub struct Store { /* private fields */ }Expand description
The live store for the declared assets.
Implementations§
Source§impl Store
impl Store
Sourcepub fn new(assets: impl IntoIterator<Item = (AssetId, f64, i64)>) -> Self
pub fn new(assets: impl IntoIterator<Item = (AssetId, f64, i64)>) -> Self
A store for assets: (id, rated kW, stale limit in seconds). Assets start offline.
Sourcepub fn set_limit(&mut self, asset: &AssetId, limit: i64) -> bool
pub fn set_limit(&mut self, asset: &AssetId, limit: i64) -> bool
Sets an asset’s stale limit; false for an undeclared asset.
Sourcepub fn push(
&mut self,
asset: &AssetId,
quantity: Quantity,
value: f64,
at: i64,
flags: Flags,
) -> Pushed
pub fn push( &mut self, asset: &AssetId, quantity: Quantity, value: f64, at: i64, flags: Flags, ) -> Pushed
Records a value taken at at.
Sourcepub fn set_offline(&mut self, asset: &AssetId, since: Option<i64>)
pub fn set_offline(&mut self, asset: &AssetId, since: Option<i64>)
Marks an asset as without connection since since — keeping the first loss when it was
already offline — or connected again with None. Held power stops counting as good at the loss.
Sourcepub fn now(&self, asset: &AssetId, now: i64) -> Option<AssetNow>
pub fn now(&self, asset: &AssetId, now: i64) -> Option<AssetNow>
The asset as of now; None for an undeclared asset.
Sourcepub fn quarters(
&self,
asset: &AssetId,
from: i64,
to: i64,
now: i64,
) -> Vec<QuarterAggregate>
pub fn quarters( &self, asset: &AssetId, from: i64, to: i64, now: i64, ) -> Vec<QuarterAggregate>
Quarter aggregates with a start in [from, to), as of now (the open quarter partly).
Trait Implementations§
Auto Trait Implementations§
impl Forget for Store
impl Freeze for Store
impl Move for Store
impl RefUnwindSafe for Store
impl Send for Store
impl Sync for Store
impl Unpin for Store
impl UnsafeUnpin for Store
impl UnwindSafe for Store
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