pub struct TransitionDecoder { /* private fields */ }Expand description
Detect cognitive state transitions from topology change patterns.
Monitors a sliding window of topology metrics and compares observed deltas against registered transition patterns to detect state changes.
Implementations§
Source§impl TransitionDecoder
impl TransitionDecoder
Sourcepub fn new(window_size: usize) -> Self
pub fn new(window_size: usize) -> Self
Create a new transition decoder with a given sliding window size.
The window size determines how many recent topology snapshots are retained for computing deltas.
Sourcepub fn register_pattern(
&mut self,
from: CognitiveState,
to: CognitiveState,
pattern: TransitionPattern,
)
pub fn register_pattern( &mut self, from: CognitiveState, to: CognitiveState, pattern: TransitionPattern, )
Register a transition pattern between two states.
Sourcepub fn current_state(&self) -> CognitiveState
pub fn current_state(&self) -> CognitiveState
Get the current estimated cognitive state.
Sourcepub fn set_current_state(&mut self, state: CognitiveState)
pub fn set_current_state(&mut self, state: CognitiveState)
Set the current state explicitly (e.g., from an external decoder).
Sourcepub fn update(&mut self, metrics: TopologyMetrics) -> Option<StateTransition>
pub fn update(&mut self, metrics: TopologyMetrics) -> Option<StateTransition>
Push a new topology snapshot and check for state transitions.
Returns Some(StateTransition) if a transition is detected,
None otherwise.
Sourcepub fn num_patterns(&self) -> usize
pub fn num_patterns(&self) -> usize
Number of registered transition patterns.
Sourcepub fn history_len(&self) -> usize
pub fn history_len(&self) -> usize
Number of topology snapshots in the history buffer.
Auto Trait Implementations§
impl Freeze for TransitionDecoder
impl RefUnwindSafe for TransitionDecoder
impl Send for TransitionDecoder
impl Sync for TransitionDecoder
impl Unpin for TransitionDecoder
impl UnsafeUnpin for TransitionDecoder
impl UnwindSafe for TransitionDecoder
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