pub struct EmotionalStateRing {
pub current: [f32; 21],
pub ring: Vec<[f32; 21]>,
pub last_update: u64,
pub total_updates: u64,
/* private fields */
}Expand description
Persistent running emotional state with ring buffer history.
Fields§
§current: [f32; 21]Current blended 21D emotional state vector.
ring: Vec<[f32; 21]>Ring buffer of recent raw emotion vectors.
last_update: u64Unix ms of last update.
total_updates: u64Total lifetime updates.
Implementations§
Source§impl EmotionalStateRing
impl EmotionalStateRing
Sourcepub fn load_or_init(output_dir: &Path) -> Self
pub fn load_or_init(output_dir: &Path) -> Self
Load from disk or return a fresh neutral state.
Sourcepub fn update(&mut self, emotion: &[f32; 21], importance: u8)
pub fn update(&mut self, emotion: &[f32; 21], importance: u8)
Update the emotional state with a new incoming emotion vector. Importance scales the blend: higher importance = stronger influence.
Sourcepub fn decay(&mut self)
pub fn decay(&mut self)
Apply time-based decay toward neutral. Call once per session or periodically.
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Returns true if the current state is strong enough to prime recall.
Sourcepub fn dominant(&self) -> Option<(&'static str, f32)>
pub fn dominant(&self) -> Option<(&'static str, f32)>
Get the dominant emotion dimension name and value.
Sourcepub fn recent_trend(&self) -> [f32; 21]
pub fn recent_trend(&self) -> [f32; 21]
Compute the average emotion over the ring buffer (recent trend).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EmotionalStateRing
impl RefUnwindSafe for EmotionalStateRing
impl Send for EmotionalStateRing
impl Sync for EmotionalStateRing
impl Unpin for EmotionalStateRing
impl UnsafeUnpin for EmotionalStateRing
impl UnwindSafe for EmotionalStateRing
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more