Struct deno_core::arena::ArenaArc

source ·
pub struct ArenaArc<T> { /* private fields */ }
Expand description

Represents an atomic reference-counted pointer into an arena-allocated object.

Implementations§

source§

impl<T> ArenaArc<T>

source

pub fn into_raw(arc: ArenaArc<T>) -> NonNull<T>

Consumes the ArenaArc, forgetting it, and returns a raw pointer to the contained data.

§Safety

This function returns a raw pointer without managing the memory, potentially leading to memory leaks if the pointer is not properly handled or deallocated.

source

pub fn clone_into_raw(arc: &ArenaArc<T>) -> NonNull<T>

Clones the ArenaArc reference, increments its reference count, and returns a raw pointer to the contained data.

This function increments the reference count of the ArenaArc.

source

pub unsafe fn from_raw(ptr: NonNull<T>) -> ArenaArc<T>

Constructs an ArenaArc from a raw pointer to the contained data.

This function safely constructs an ArenaArc from a raw pointer, assuming the pointer is valid, properly aligned, and was originally created by into_raw or clone_into_raw.

§Safety

This function assumes the provided ptr is a valid raw pointer to the data within an ArenaArc object. Misuse may lead to undefined behavior, memory unsafety, or data corruption.

source

pub unsafe fn clone_from_raw(ptr: NonNull<T>) -> ArenaArc<T>

Clones an ArenaArc reference from a raw pointer and increments its reference count.

This method increments the reference count of the ArenaArc instance associated with the provided raw pointer, allowing multiple references to the same allocated data.

§Safety

This function assumes that the provided ptr is a valid raw pointer to the data within an ArenaArc object. Improper usage may lead to memory unsafety or data corruption.

source

pub unsafe fn clone_raw_from_raw(ptr: NonNull<T>)

Increments the reference count associated with the raw pointer to an ArenaArc-managed data.

This method manually increases the reference count of the ArenaArc instance associated with the provided raw pointer. It allows incrementing the reference count without constructing a full ArenaArc instance, ideal for scenarios where direct manipulation of raw pointers is required.

§Safety

This method bypasses some safety checks enforced by the ArenaArc type. Incorrect usage or mishandling of raw pointers might lead to memory unsafety or data corruption. Use with caution and ensure proper handling of associated data.

source

pub unsafe fn drop_from_raw(ptr: NonNull<T>)

Drops the ArenaArc reference pointed to by the raw pointer.

If the reference count drops to zero, the associated data is returned to the arena.

§Safety

This function assumes that the provided ptr is a valid raw pointer to the data within an ArenaArc object. Improper usage may lead to memory unsafety or data corruption.

Trait Implementations§

source§

impl<T> AsRef<T> for ArenaArc<T>

source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T> Deref for ArenaArc<T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T> Drop for ArenaArc<T>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<T: Send + Sync> Send for ArenaArc<T>

source§

impl<T: Send + Sync> Sync for ArenaArc<T>

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for ArenaArc<T>

§

impl<T> Unpin for ArenaArc<T>

§

impl<T> !UnwindSafe for ArenaArc<T>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.