pub struct UniqueRc<T: ?Sized>(/* private fields */);Expand description
An uniquely owned Rc.
Useful for constructing Rc, since we are certain that when Rc is
initially created, there is an unique reference. Once initially mutation
is done, it can be convert to Rc with shareable().
Implementations§
Source§impl<T> UniqueRc<T>
impl<T> UniqueRc<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 UniqueRc.
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 UniqueRc.
Convert to a shareable Rc<T>.
Convert to a shareable Pin<Rc<T>>.
Sourcepub fn new_uninit() -> UniqueRc<MaybeUninit<T>>
pub fn new_uninit() -> UniqueRc<MaybeUninit<T>>
Constructs a new UniqueRc with uninitialized contents.
Source§impl<T> UniqueRc<MaybeUninit<T>>
impl<T> UniqueRc<MaybeUninit<T>>
Sourcepub unsafe fn assume_init(self) -> UniqueRc<T>
pub unsafe fn assume_init(self) -> UniqueRc<T>
Convert to an initialized Rc.
§Safety
This function is unsafe as this is equivalent to MaybeUninit::assume_init.
Trait Implementations§
Source§impl<T> PtrPinWith<T> for UniqueRc<T>
Available on crate feature alloc_pin_with only.
impl<T> PtrPinWith<T> for UniqueRc<T>
Available on crate feature
alloc_pin_with only.Source§impl<T> PtrTryPinWith<T> for UniqueRc<T>
Available on crate feature alloc_try_pin_with only.
impl<T> PtrTryPinWith<T> for UniqueRc<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 UniqueRc<T>where
T: ?Sized,
impl<T> RefUnwindSafe for UniqueRc<T>where
T: RefUnwindSafe + ?Sized,
impl<T> !Send for UniqueRc<T>
impl<T> !Sync for UniqueRc<T>
impl<T> Unpin for UniqueRc<T>where
T: ?Sized,
impl<T> UnwindSafe for UniqueRc<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