pactum-annotations 0.6.1

Declarative field normalization and validation for pactum contracts
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// Pure context passed into `validate_with` so time-based checks stay deterministic.
#[derive(Debug, Clone, Default)]
pub struct ValidationContext {
    /// Unix epoch milliseconds. Required by `timestamp_ms(after_now)` / `before_now`.
    pub now_ms: Option<i64>,
}

impl ValidationContext {
    pub fn new() -> Self {
        Self::default()
    }

    pub fn with_now_ms(now_ms: i64) -> Self {
        Self {
            now_ms: Some(now_ms),
        }
    }
}