pactum_annotations/context.rs
1/// Pure context passed into `validate_with` so time-based checks stay deterministic.
2#[derive(Debug, Clone, Default)]
3pub struct ValidationContext {
4 /// Unix epoch milliseconds. Required by `timestamp_ms(after_now)` / `before_now`.
5 pub now_ms: Option<i64>,
6}
7
8impl ValidationContext {
9 pub fn new() -> Self {
10 Self::default()
11 }
12
13 pub fn with_now_ms(now_ms: i64) -> Self {
14 Self {
15 now_ms: Some(now_ms),
16 }
17 }
18}