#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub(in crate::db) struct FieldId(u32);
impl FieldId {
#[must_use]
pub(in crate::db) const fn new(raw: u32) -> Self {
Self(raw)
}
#[must_use]
pub(in crate::db) const fn get(self) -> u32 {
self.0
}
#[must_use]
pub(in crate::db) fn from_initial_slot(slot: usize) -> Self {
let next = u32::try_from(slot)
.expect("generated field slot should fit in u32")
.checked_add(1)
.expect("generated field slot should not exhaust u32 field IDs");
Self(next)
}
}