pub struct UniqueArc<T: ?Sized>(/* private fields */);
Expand description
An uniquely owned Arc
.
Useful for constructing Arc
, since we are certain that when Arc
is
initially created, there is an unique reference. Once initially mutation
is done, it can be convert to Arc
with shareable()
.
Implementations§
Source§impl<T> UniqueArc<T>
impl<T> UniqueArc<T>
Sourcepub fn new(data: T) -> Self
Available on crate feature alloc_pin_with
only.
pub fn new(data: T) -> Self
alloc_pin_with
only.Constructs a new UniqueArc
.
Sourcepub fn try_new(data: T) -> Result<Self, AllocError>
Available on crate feature alloc_try_pin_with
only.
pub fn try_new(data: T) -> Result<Self, AllocError>
alloc_try_pin_with
only.Try to constructs a new UniqueArc
.
Convert to a shareable Arc<T>
.
Convert to a shareable Pin<Arc<T>>
.
Sourcepub fn new_uninit() -> UniqueArc<MaybeUninit<T>>
pub fn new_uninit() -> UniqueArc<MaybeUninit<T>>
Constructs a new UniqueArc
with uninitialized contents.
Source§impl<T> UniqueArc<MaybeUninit<T>>
impl<T> UniqueArc<MaybeUninit<T>>
Sourcepub unsafe fn assume_init(self) -> UniqueArc<T>
pub unsafe fn assume_init(self) -> UniqueArc<T>
Convert to an initialized Arc.
§Safety
This function is unsafe as this is equivalent to MaybeUninit::assume_init
.
Trait Implementations§
Source§impl<T> PtrInit<T> for UniqueArc<T>
Available on crate feature alloc
only.Pin-initialize a UniqueArc
.
impl<T> PtrInit<T> for UniqueArc<T>
Available on crate feature
alloc
only.Pin-initialize a UniqueArc
.
Source§impl<T> PtrPinWith<T> for UniqueArc<T>
Available on crate feature alloc_pin_with
only.
impl<T> PtrPinWith<T> for UniqueArc<T>
Available on crate feature
alloc_pin_with
only.Source§impl<T> PtrTryPinWith<T> for UniqueArc<T>
Available on crate feature alloc_try_pin_with
only.
impl<T> PtrTryPinWith<T> for UniqueArc<T>
Available on crate feature
alloc_try_pin_with
only.fn try_pin_with<E, I>(init: I) -> Result<Pin<Self>, E>
Auto Trait Implementations§
impl<T> Freeze for UniqueArc<T>where
T: ?Sized,
impl<T> RefUnwindSafe for UniqueArc<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Send for UniqueArc<T>
impl<T> Sync for UniqueArc<T>
impl<T> Unpin for UniqueArc<T>where
T: ?Sized,
impl<T> UnwindSafe for UniqueArc<T>where
T: RefUnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more