kitt_score 0.1.0

Decision engine at the core of Project KITT — in-memory stateful matching with pluggable scoring backends.
Documentation
//! Stored record for a registered action inside a `LocationState`.

use crate::engine::compiled_scorer::CompiledScorer;
use crate::location::state::LocationView;
use crate::{ActionId, UnixTime};
use std::sync::Arc;

/// Stored record for a registered action inside a `LocationState`.
pub struct ActionEntry<T> {
    /// Caller-assigned action ID.
    pub action_id: ActionId,
    /// End time of the validity window (exclusive upper bound).
    pub end: UnixTime,
    /// Start time of the validity window.
    pub start: UnixTime,
    /// Tie-breaker priority — higher wins when scores are equal.
    pub priority: u8,
    /// Compiled scorer; dispatched via `CompiledScorer` match on the hot path.
    pub scorer: CompiledScorer,
    /// Payload returned verbatim on decision (unless `post` is set).
    pub payload: T,
    /// Optional post-processor applied to the winning payload.
    #[allow(clippy::type_complexity)]
    pub post: Option<Arc<dyn Fn(&T, &LocationView<'_>) -> T + Send + Sync>>,
}