pactum-annotations 0.7.0

Declarative field normalization and validation for pactum contracts
Documentation
/// Pure context passed into `validate_with` so time-based checks stay deterministic.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
pub struct ValidationContext {
    /// Unix epoch milliseconds. Required by `timestamp_ms(after_now)` / `before_now`.
    pub now_ms: Option<i64>,
}

impl ValidationContext {
    #[must_use]
    pub const fn new() -> Self {
        Self { now_ms: None }
    }

    #[must_use]
    pub const fn with_now_ms(now_ms: i64) -> Self {
        Self {
            now_ms: Some(now_ms),
        }
    }
}