[][src]Struct memur::WeakArena

pub struct WeakArena { /* fields omitted */ }

A weak Arena reference that holds a pointer to valid memory until dropped.

As long as the original strong Arena is alive, this reference can be upgraded to Arena. If the Arena is no longer alive, the memory can no longer be mutated, and the drop functions for all root objects in the Arena are already executed.

However, if your structure does not need to be dropped (i.e. bunch of bytes), the bytes can be safely accessed as long as you hold the WeakArena reference, even if is_alive returns false.

The WeakArena, like Arena, can not be shared between threads.

Implementations

impl WeakArena[src]

pub fn is_alive(&self) -> bool[src]

Returns true if drop functions for the arena structures were not yet executed (the Arena is not dropped).

pub unsafe fn upload_auto_drop<T>(
    &self,
    value: T
) -> Result<(*mut T, *const Option<DropItem>), UploadError>
[src]

Place item to arena and return a pointer to it, and also add drop function to drop list to drop this item when there are no remaining Arena instances.

pub unsafe fn upload_no_drop<T>(&self, value: T) -> Result<*mut T, UploadError>[src]

Place item to arena and return a pointer to it, without adding a drop function.

pub unsafe fn upload_no_drop_bytes(
    &self,
    len: usize,
    value: impl Iterator<Item = u8>
) -> Result<*mut u8, UploadError>
[src]

Place a chunk of bytes to arena and return a pointer to the first byte.

pub fn arena(&self) -> Option<Arena>[src]

Try to upgrade WeakArena to Arena.

Trait Implementations

impl Clone for WeakArena[src]

impl Drop for WeakArena[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

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.