use crate::validation::Validate;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
#[serde(deny_unknown_fields)]
pub enum AllocationSlot {
MemoryManagerId(u8),
}
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
#[serde(deny_unknown_fields)]
pub struct AllocationSlotDescriptor {
pub(crate) slot: AllocationSlot,
}
impl AllocationSlotDescriptor {
#[must_use]
pub const fn slot(&self) -> &AllocationSlot {
&self.slot
}
}
impl Validate for AllocationSlotDescriptor {
type Error = super::memory_manager::MemoryManagerSlotError;
fn validate(&self) -> Result<(), Self::Error> {
self.memory_manager_id().map(|_| ())
}
}