stratus/eth/primitives/
unix_time_now.rs

1use display_json::DebugAsJson;
2
3use crate::eth::primitives::UnixTime;
4
5/// [`UnixTime`] that automatically sets the current time when created.
6#[derive(DebugAsJson, Clone, PartialEq, Eq, derive_more::Deref, serde::Serialize, serde::Deserialize)]
7#[cfg_attr(test, derive(fake::Dummy))]
8pub struct UnixTimeNow(#[deref] UnixTime);
9
10impl Default for UnixTimeNow {
11    fn default() -> Self {
12        Self(UnixTime::now())
13    }
14}
15
16impl From<UnixTime> for UnixTimeNow {
17    fn from(value: UnixTime) -> Self {
18        Self(value)
19    }
20}