use std::marker::PhantomData;
#[derive(Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
pub struct AirId<T> {
pub(crate) uuid: uuid::Uuid,
#[serde(skip)]
_tag: PhantomData<T>,
}
impl<T> Clone for AirId<T> {
fn clone(&self) -> Self {
*self
}
}
impl<T> Copy for AirId<T> {}
impl<T> AirId<T> {
pub fn new() -> Self {
Self {
uuid: uuid::Uuid::now_v7(),
_tag: PhantomData,
}
}
pub fn to_string_id(&self) -> String {
self.uuid.to_string()
}
pub fn to_bytes(&self) -> Vec<u8> {
self.uuid.as_bytes().to_vec()
}
}
impl<T> Default for AirId<T> {
fn default() -> Self {
Self::new()
}
}