#[entity_ptr_id]Expand description
Syntax:
ⓘ
#[entity_ptr_id(WrapperName)] -- default policy (256)
#[entity_ptr_id(WrapperName, options...)] -- custom policy (named argument)
#[entity_ptr_id(WrapperName, opaque)] -- opaque ID with default policy (256)
#[entity_ptr_id(WrapperName, options..., opaque)] -- opaque ID with custom policy
pub struct|enum|union ObjType { ... }Options:
policy = <PolicyType>: specify allocation policy type, e.g.,Policy256,512, etc.opaque: makes the wrapper opaque (restricts field visibility to crate-only)allocator_type = AllocTypeName: generates a type alias for the correspondingEntityAlloc<..., ...>
Generates:
ⓘ
/// non-opaque wrapper
pub struct $WrapperName(pub $ObjType);
/// opaque wrapper
pub struct $WrapperName(pub(crate) $ObjType);
impl $crate::IEntityAllocPtr for $WrapperName {
type ObjectT = $ObjType;
type PolicyT = $PolicyType;
type AllocT = $crate::EntityAlloc<$ObjType, Self::PolicyT>;
fn from_raw_ptrid(ptr: PtrID<Self::ObjectT, Self::PolicyT>) -> Self {
Self(ptr)
}
fn into_raw_ptrid(self) -> PtrID<Self::ObjectT, Self::PolicyT> {
self.0
}
}