use std::ops::Deref;
use crate::timestamp::{Timestamp, Timestamped};
use super::TradeTimestamped;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct TradeTimestamp(Timestamp);
impl TradeTimestamp {
pub(crate) fn from_timestamp(
timestamp: Timestamp,
) -> Self {
Self(timestamp)
}
pub fn as_timestamp(
&self,
) -> &Timestamp {
&self.0
}
pub fn into_timestamp(
self,
) -> Timestamp {
self.0
}
}
impl Deref for TradeTimestamp {
type Target = Timestamp;
fn deref(
&self,
) -> &Self::Target {
&self.0
}
}
impl Timestamped for TradeTimestamp {
fn timestamp(
&self,
) -> Timestamp {
self.0
}
}
impl TradeTimestamped for TradeTimestamp {
fn trade_timestamp(
&self,
) -> TradeTimestamp {
*self
}
}