Struct phper_alloc::EBox
source · pub struct EBox<T> { /* private fields */ }
Expand description
The Box which use php emalloc
and efree
to manage memory.
TODO Now feature allocator_api
is still unstable, implement myself, use
Box<T, Alloc> later.
Implementations§
source§impl<T> EBox<T>
impl<T> EBox<T>
sourcepub fn new(x: T) -> Self
pub fn new(x: T) -> Self
Allocates heap memory using emalloc
then places x
into it.
Panic
Panic if size_of::<T>()
equals zero.
sourcepub fn into_raw(b: EBox<T>) -> *mut T
pub fn into_raw(b: EBox<T>) -> *mut T
Consumes and returning a wrapped raw pointer.
Will leak memory.