[−][src]Struct memur::WeakArena
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]
&self,
value: T
) -> Result<(*mut T, *const Option<DropItem>), UploadError>
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]
&self,
len: usize,
value: impl Iterator<Item = u8>
) -> Result<*mut u8, UploadError>
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]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Drop for WeakArena
[src]
Auto Trait Implementations
impl RefUnwindSafe for WeakArena
impl !Send for WeakArena
impl !Sync for WeakArena
impl Unpin for WeakArena
impl UnwindSafe for WeakArena
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,