use super::types::{
AclHandle, AsyncItemHandle, BodyHandle, DictionaryHandle, EndpointHandle, KvStoreHandle,
ObjectStoreHandle, PendingRequestHandle, RequestHandle, ResponseHandle, SecretHandle,
SecretStoreHandle,
};
macro_rules! wiggle_entity {
($entity:ident) => {
impl cranelift_entity::EntityRef for $entity {
fn new(index: usize) -> Self {
debug_assert!(index < (u32::MAX as usize));
(index as u32).into()
}
fn index(self) -> usize {
let i: u32 = self.into();
i as usize
}
}
};
}
wiggle_entity!(AclHandle);
wiggle_entity!(AsyncItemHandle);
wiggle_entity!(BodyHandle);
wiggle_entity!(DictionaryHandle);
wiggle_entity!(EndpointHandle);
wiggle_entity!(KvStoreHandle);
wiggle_entity!(ObjectStoreHandle);
wiggle_entity!(PendingRequestHandle);
wiggle_entity!(RequestHandle);
wiggle_entity!(ResponseHandle);
wiggle_entity!(SecretHandle);
wiggle_entity!(SecretStoreHandle);