Struct phper_alloc::EBox[][src]

pub struct EBox<T: EAllocatable> { /* fields omitted */ }
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

impl<T: EAllocatable> EBox<T>[src]

pub fn new(x: T) -> Self[src]

Allocates heap memory using emalloc then places x into it.

Panic

Panic if size_of::<T>() equals zero.

pub unsafe fn from_raw(raw: *mut T) -> Self[src]

Constructs from a raw pointer.

pub fn into_raw(b: EBox<T>) -> *mut T[src]

Consumes and returning a wrapped raw pointer.

Will leak memory.

Trait Implementations

impl<T: EAllocatable> Deref for EBox<T>[src]

type Target = T

The resulting type after dereferencing.

fn deref(&self) -> &Self::Target[src]

Dereferences the value.

impl<T: EAllocatable> DerefMut for EBox<T>[src]

fn deref_mut(&mut self) -> &mut Self::Target[src]

Mutably dereferences the value.

impl<T: EAllocatable> Drop for EBox<T>[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl<T> RefUnwindSafe for EBox<T> where
    T: RefUnwindSafe

impl<T> !Send for EBox<T>

impl<T> !Sync for EBox<T>

impl<T> Unpin for EBox<T>

impl<T> UnwindSafe for EBox<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.