ic_memory/slot/
descriptor.rs1use crate::validation::Validate;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
12#[serde(deny_unknown_fields)]
13pub enum AllocationSlot {
14 MemoryManagerId(u8),
16}
17
18#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
25#[serde(deny_unknown_fields)]
26pub struct AllocationSlotDescriptor {
27 pub(crate) slot: AllocationSlot,
29}
30
31impl AllocationSlotDescriptor {
32 #[must_use]
34 pub const fn slot(&self) -> &AllocationSlot {
35 &self.slot
36 }
37}
38
39impl Validate for AllocationSlotDescriptor {
40 type Error = super::memory_manager::MemoryManagerSlotError;
41
42 fn validate(&self) -> Result<(), Self::Error> {
43 self.memory_manager_id().map(|_| ())
44 }
45}