Struct UniqueArc

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

Source

pub fn new(data: T) -> Self

Available on crate feature alloc_pin_with only.

Constructs a new UniqueArc.

Source

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

Available on crate feature alloc_try_pin_with only.

Try to constructs a new UniqueArc.

Source

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

Convert to a shareable Arc<T>.

Source

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

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

Source

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

Constructs a new UniqueArc with uninitialized contents.

Source§

impl<T> UniqueArc<MaybeUninit<T>>

Source

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

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<T> DerefMut for UniqueArc<T>

Source§

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

Mutably dereferences the value.
Source§

impl<T> From<UniqueArc<T>> for Pin<UniqueArc<T>>

Source§

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

Converts to this type from the input type.
Source§

impl<T> PtrInit<T> for UniqueArc<T>

Available on crate feature alloc only.

Pin-initialize a UniqueArc.

Source§

type Uninit = UniqueArc<MaybeUninit<T>>

Source§

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

Source§

impl<T> PtrPinWith<T> for UniqueArc<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 UniqueArc<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 UniqueArc<T>
where T: ?Sized,

§

impl<T> RefUnwindSafe for UniqueArc<T>
where T: RefUnwindSafe + ?Sized,

§

impl<T> Send for UniqueArc<T>
where T: Sync + Send + ?Sized,

§

impl<T> Sync for UniqueArc<T>
where T: Sync + Send + ?Sized,

§

impl<T> Unpin for UniqueArc<T>
where T: ?Sized,

§

impl<T> UnwindSafe for UniqueArc<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.