containerof::containerof_intrusive!
[−]
[src]
macro_rules! containerof_intrusive { ($nt:ident = $container:ty : $field:ident :: $fieldtype:ty) => ( containerof_intrusive!(_decl $nt); containerof_intrusive!(_impl $nt = $container : $field :: $fieldtype); ); (pub $nt:ident = $container:ty : $field:ident :: $fieldtype:ty) => ( containerof_intrusive!(_decl pub $nt); containerof_intrusive!(_impl $nt = $container : $field :: $fieldtype); ); // below are implementation details. you should not invoke these // macro variants directly. (_decl $nt:ident) => ( struct $nt($crate::IntrusiveAlias); ); (_decl pub $nt:ident) => ( pub struct $nt($crate::IntrusiveAlias); ); (_impl $nt:ident = $container:ty : $field:ident :: $fieldtype:ty) => ( impl $crate::IntrusiveBase for $nt { type Container = $container; type Field = $fieldtype; #[inline] fn offset() -> usize { containerof_field_offset!($container : $field) } #[inline] unsafe fn new(ia: $crate::IntrusiveAlias) -> $nt { $nt(ia) } #[inline] unsafe fn as_alias<'a>(&'a self) -> &'a IntrusiveAlias { ::std::mem::transmute(self as *const _) } } ); }
Define a type representing the translation between an intrusive field and its containing structure.