Struct UniqueArcUninit

pub(in ::sync) struct UniqueArcUninit<T: ?Sized, A: Allocator> { pub(in ::sync) ptr: NonNull<ArcInner<T>>, pub(in ::sync) layout_for_value: Layout, pub(in ::sync) alloc: Option<A> }

A unique owning pointer to an ArcInner that does not imply the contents are initialized, but will deallocate it (without dropping the value) when dropped.

This is a helper for [Arc::make_mut()] to ensure correct cleanup on panic.

Fields

ptr: NonNull<ArcInner<T>>
layout_for_value: Layout
alloc: Option<A>

Implementations

impl<T: ?Sized, A: Allocator> UniqueArcUninit<T, A>

fn new(for_value: &T, alloc: A) -> UniqueArcUninit<T, A>

Allocates an ArcInner with layout suitable to contain for_value or a clone of it.

fn try_new(for_value: &T, alloc: A) -> Result<UniqueArcUninit<T, A>, AllocError>

Allocates an ArcInner with layout suitable to contain for_value or a clone of it, returning an error if allocation fails.

fn data_ptr(&mut self) -> *mut T

Returns the pointer to be written into to initialize the Arc.

unsafe fn into_arc(self) -> Arc<T, A>

Upgrade this into a normal Arc.

Safety

The data must have been initialized (by writing to [Self::data_ptr()]).

Trait Implementations

impl<T: ?Sized, A: Allocator> Drop for UniqueArcUninit<T, A>

fn drop(&mut self)

Auto Trait Implementations

impl<T, A> !Send for UniqueArcUninit<T, A>

impl<T, A> !Sync for UniqueArcUninit<T, A>

impl<T, A> Freeze for UniqueArcUninit<T, A> where NonNull<ArcInner<T>>: Freeze, Option<A>: Freeze, T: ?Sized,

impl<T, A> RefUnwindSafe for UniqueArcUninit<T, A> where NonNull<ArcInner<T>>: RefUnwindSafe, Option<A>: RefUnwindSafe, T: ?Sized,

impl<T, A> Unpin for UniqueArcUninit<T, A> where NonNull<ArcInner<T>>: Unpin, Option<A>: Unpin, T: ?Sized,

impl<T, A> UnsafeUnpin for UniqueArcUninit<T, A> where NonNull<ArcInner<T>>: UnsafeUnpin, Option<A>: UnsafeUnpin, T: ?Sized,

impl<T, A> UnwindSafe for UniqueArcUninit<T, A> where NonNull<ArcInner<T>>: UnwindSafe, Option<A>: UnwindSafe, T: ?Sized,

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> From<T> for UniqueArcUninit<T, A>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for UniqueArcUninit<T, A> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for UniqueArcUninit<T, A>

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

fn into(self) -> U

Calls U::from(self).

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

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

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

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

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