[][src]Struct owned_alloc::OwnedAlloc

pub struct OwnedAlloc<T> where
    T: ?Sized
{ /* fields omitted */ }

Dynamic allocation of a T whose memory is considered fully initialized. The allocation and its content are freed on drop. Similar to a Box. If the size of the allocation is zero, no allocation is performed and a dangling pointer is used (just like in std). For the drop checker, the type acts as if it contains a T due to usage of PhantomData<T>.

Methods

impl<T> OwnedAlloc<T>
[src]

Creates an allocation and initializes it to the passed argument. In case of allocation error, the handler registered via stdlib is called.

Creates an allocation and initializes it to the passed argument. In case of allocation error, Err is returned.

Moves the stored value out from the allocation. The value and the allocation now considered uninitialized are returned.

impl<T> OwnedAlloc<T> where
    T: ?Sized
[src]

Recreate the OwnedAlloc from a raw non-null pointer.

Safety

This functions is unsafe because passing the wrong pointer leads to undefined behaviour. Passing a pointer to uninitialized memory is also undefined behaviour.

Converts the plain old standard library Box into an owned allocation.

Safety

This function is unsafe because there are no guarantees that Box and OwnedAlloc allocate in the same way. They probably do in the Rust version you are using, but there are no future guarantees.

Returns the raw non-null pointer of the allocation.

"Forgets" dropping both the allocation and its content and returns its raw non-null pointer.

Converts the owned allocation into a plain old standard library Box.

Safety

This function is unsafe because there are no guarantees that Box and OwnedAlloc allocate in the same way. They probably do in the Rust version you are using, but there are no future guarantees.

Drops the memory and returns the allocation now considered uninitialized.

"Forgets" about dropping the inner value and returns an uninitialized allocation.

Trait Implementations

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

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

impl<T> From<OwnedAlloc<T>> for MaybeUninitAlloc<T> where
    T: ?Sized
[src]

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

impl<T> Clone for OwnedAlloc<T> where
    T: Clone
[src]

Performs copy-assignment from source. Read more

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

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

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

The resulting type after dereferencing.

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

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

impl<T> From for T
[src]

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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