apple-quant-algorithmic 0.4.0

Apple Quant's algorithmic library.
Documentation
use std::ops::Deref;

use super::{Timestamp, Timestamped};

#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct TickTimestamp(Timestamp);

impl TickTimestamp {
	pub(crate) fn now() -> Self {
		let timestamp = Timestamp::now();
		Self(timestamp)
	}

	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 Timestamped for TickTimestamp {
	fn timestamp(
		&self,
	) -> Timestamp {
		self.0
	}
}

impl Deref for TickTimestamp {
	type Target = Timestamp;

	fn deref(
		&self,
	) -> &Self::Target {
		&self.0
	}
}