pub struct StateLine {
pub domain: StateDomain,
pub activity: f32,
pub trend: Trend,
pub hotspots: Vec<GeoHotspot>,
pub last_updated: WorldTick,
pub activity_history: Vec<f32>,
}Expand description
A single domain’s state line — tracks activity level and trend.
Fields§
§domain: StateDomainThe domain this state line tracks.
activity: f32Normalised activity level (0.0–1.0).
trend: TrendCurrent trend direction.
hotspots: Vec<GeoHotspot>Spatial hotspots within this domain.
last_updated: WorldTickTick of last update.
activity_history: Vec<f32>Recent activity history for trend detection (not serialised).
Implementations§
Source§impl StateLine
impl StateLine
Sourcepub fn new(domain: StateDomain) -> Self
pub fn new(domain: StateDomain) -> Self
Create a new state line at zero activity.
Sourcepub fn update_activity(&mut self, sample: f32, tick: WorldTick)
pub fn update_activity(&mut self, sample: f32, tick: WorldTick)
Apply an exponential moving average (EMA) update with alpha = 0.3, then detect the current trend.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for StateLine
impl<'de> Deserialize<'de> for StateLine
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
Auto Trait Implementations§
impl Freeze for StateLine
impl RefUnwindSafe for StateLine
impl Send for StateLine
impl Sync for StateLine
impl Unpin for StateLine
impl UnsafeUnpin for StateLine
impl UnwindSafe for StateLine
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