UniqueRc

Struct UniqueRc 

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

Source

pub fn new(data: T) -> Self

Available on crate feature alloc_pin_with only.

Constructs a new UniqueRc.

Source

pub fn try_new(data: T) -> Result<Self, AllocError>

Available on crate feature alloc_try_pin_with only.

Try to constructs a new UniqueRc.

Source

pub fn shareable(x: Self) -> Rc<T>

Convert to a shareable Rc<T>.

Source

pub fn shareable_pin(x: Pin<Self>) -> Pin<Rc<T>>

Convert to a shareable Pin<Rc<T>>.

Source

pub fn new_uninit() -> UniqueRc<MaybeUninit<T>>

Constructs a new UniqueRc with uninitialized contents.

Source§

impl<T> UniqueRc<MaybeUninit<T>>

Source

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> Deref for UniqueRc<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<T> DerefMut for UniqueRc<T>

Source§

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

Mutably dereferences the value.
Source§

impl<T> From<UniqueRc<T>> for Pin<UniqueRc<T>>

Source§

fn from(x: UniqueRc<T>) -> Pin<UniqueRc<T>>

Converts to this type from the input type.
Source§

impl<T> PtrInit<T> for UniqueRc<T>

Available on crate feature alloc only.
Source§

type Uninit = UniqueRc<MaybeUninit<T>>

Source§

fn init<E, I>( uninit: Pin<UniqueRc<MaybeUninit<T>>>, init: I, ) -> Result<Pin<UniqueRc<T>>, E>
where I: Init<T, E>,

Source§

impl<T> PtrPinWith<T> for UniqueRc<T>

Available on crate feature alloc_pin_with only.
Source§

fn pin_with<E, I>(init: I) -> Result<Pin<Self>, E>
where I: Init<T, E>,

Source§

impl<T> PtrTryPinWith<T> for UniqueRc<T>

Available on crate feature alloc_try_pin_with only.
Source§

fn try_pin_with<E, I>(init: I) -> Result<Pin<Self>, E>
where I: Init<T, E>, E: From<AllocError>,

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> 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, E> Init<T, E> for T

Source§

fn __init<'a>( self, this: PinUninit<'a, T>, ) -> Result<InitOk<'a, T>, InitErr<'a, E>>

Pin-initialize this.
Source§

fn map_err<E2, F>(self, f: F) -> MapErr<T, E, E2, Self, F>
where F: FnOnce(E) -> E2,

Maps the error from E to E2.
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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.