Struct oxc_allocator::Box

source ·
pub struct Box<'alloc, T: ?Sized>(/* private fields */);
Expand description

A Box without Drop. This is used for over coming self-referential structs. It is a memory leak if the boxed value has a Drop implementation.

Implementations§

source§

impl<'alloc, T> Box<'alloc, T>

source

pub fn unbox(self) -> T

source§

impl<'alloc, T> Box<'alloc, T>

source

pub fn new_in(value: T, allocator: &Allocator) -> Self

source

pub const unsafe fn dangling() -> Self

Create a fake Box with a dangling pointer.

§SAFETY

Safe to create, but must never be dereferenced, as does not point to a valid T. Only purpose is for mocking types without allocating for const assertions.

source§

impl<'a, T> Box<'a, T>

source

pub fn address(&self) -> Address

Trait Implementations§

source§

impl<'alloc, T: ?Sized> AsMut<T> for Box<'alloc, T>

source§

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

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

impl<'alloc, T: ?Sized> AsRef<T> for Box<'alloc, T>

source§

fn as_ref(&self) -> &T

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

impl<'old_alloc, 'new_alloc, T, C> CloneIn<'new_alloc> for Box<'old_alloc, T>
where T: CloneIn<'new_alloc, Cloned = C>,

source§

type Cloned = Box<'new_alloc, C>

source§

fn clone_in(&self, allocator: &'new_alloc Allocator) -> Self::Cloned

source§

impl<'alloc, T: ?Sized + Debug> Debug for Box<'alloc, T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'alloc, T: ?Sized> Deref for Box<'alloc, T>

source§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &T

Dereferences the value.
source§

impl<'alloc, T: ?Sized> DerefMut for Box<'alloc, T>

source§

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

Mutably dereferences the value.
source§

impl<'a, T> FromIn<'a, T> for Box<'a, T>

source§

fn from_in(value: T, allocator: &'a Allocator) -> Self

source§

impl<'alloc, T: Hash> Hash for Box<'alloc, T>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more

Auto Trait Implementations§

§

impl<'alloc, T> Freeze for Box<'alloc, T>
where T: ?Sized,

§

impl<'alloc, T> RefUnwindSafe for Box<'alloc, T>
where T: RefUnwindSafe + ?Sized,

§

impl<'alloc, T> !Send for Box<'alloc, T>

§

impl<'alloc, T> !Sync for Box<'alloc, T>

§

impl<'alloc, T> Unpin for Box<'alloc, T>
where T: Unpin + ?Sized,

§

impl<'alloc, T> UnwindSafe for Box<'alloc, 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<'a, T> FromIn<'a, T> for T

source§

fn from_in(t: T, _: &'a Allocator) -> T

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<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

source§

fn into_in(self, allocator: &'a Allocator) -> U

source§

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

source§

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>,

source§

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.