use std::marker::PhantomData;
use crate::property::{PropertyKey, kind::PropertyValueKind};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct RawPropertySpec {
key: PropertyKey,
composition_order: u8,
}
impl RawPropertySpec {
pub(crate) const fn new(key: PropertyKey, composition_order: u8) -> Self {
Self {
key,
composition_order,
}
}
#[must_use]
pub const fn key(&self) -> PropertyKey {
self.key
}
#[must_use]
pub const fn composition_order(&self) -> u8 {
self.composition_order
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct PropertySpec<K: PropertyValueKind> {
raw: RawPropertySpec,
_kind: PhantomData<fn() -> K>,
}
impl<K: PropertyValueKind> PropertySpec<K> {
#[must_use]
pub const fn new(key: PropertyKey, composition_order: u8) -> Self {
Self {
raw: RawPropertySpec::new(key, composition_order),
_kind: PhantomData,
}
}
#[must_use]
pub const fn raw(self) -> RawPropertySpec {
self.raw
}
}