ac-algorithm 0.2.0

Algorithm competition domain logic for ac
Documentation
//! Solution snapshots: the source file is the source of truth; metadata
//! records identity and the hash of the exact byte string under test.

use std::path::PathBuf;
use std::time::SystemTime;

use serde::{Deserialize, Serialize};

use crate::ids::{SolutionId, TaskId};

/// A recorded solution for a task.
///
/// `source_path` points at the editable file (the source of truth per
/// `product-requirements.md` ยง5); `source_sha256` pins the byte string that
/// tests and submissions refer to, so preview/test/submit always agree on
/// the same content (ADR-0005 invariant 3).
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Solution {
    /// Solution identifier.
    pub id: SolutionId,
    /// Task this solution targets.
    pub task: TaskId,
    /// Path to the editable source file.
    pub source_path: PathBuf,
    /// Lowercase hex SHA-256 of the source bytes at snapshot time.
    pub source_sha256: String,
    /// Local revision counter, bumped on each recorded snapshot.
    pub revision: u64,
    /// When the snapshot was recorded.
    pub created_at: SystemTime,
}