Struct deno_core::arena::ArenaRc

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

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

Implementations§

source§

impl<T> ArenaRc<T>

source

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

Consumes the ArenaRc, 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: &ArenaRc<T>) -> NonNull<T>

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

This function increments the reference count of the ArenaRc.

source

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

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

This function safely constructs an ArenaRc 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 ArenaRc object. Misuse may lead to undefined behavior, memory unsafety, or data corruption.

source

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

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

This method increments the reference count of the ArenaRc 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 ArenaRc 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 ArenaRc-managed data.

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

§Safety

This method bypasses some safety checks enforced by the ArenaRc 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 ArenaRc 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 ArenaRc object. Improper usage may lead to memory unsafety or data corruption.

Trait Implementations§

source§

impl<T> AsRef<T> for ArenaRc<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 ArenaRc<T>

§

type Target = T

The resulting type after dereferencing.
source§

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

Dereferences the value.
source§

impl<T> Drop for ArenaRc<T>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for ArenaRc<T>

§

impl<T> !Send for ArenaRc<T>

§

impl<T> !Sync for ArenaRc<T>

§

impl<T> Unpin for ArenaRc<T>

§

impl<T> !UnwindSafe for ArenaRc<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.