[][src]Struct thin_dst::ThinArc

pub struct ThinArc<Head, SliceItem> { /* fields omitted */ }

A thin version of Arc.

Methods

impl<Head, SliceItem> ThinArc<Head, SliceItem>[src]

pub unsafe fn from_erased(ptr: ErasedPtr) -> Self[src]

Construct an owned pointer from an erased pointer.

Safety

This pointer must logically own a valid instance of Self.

pub fn erase(this: Self) -> ErasedPtr[src]

Convert this owned pointer into an erased pointer.

To avoid a memory leak the pointer must be converted back using Self::from_erased.

impl<Head, SliceItem> ThinArc<Head, SliceItem>[src]

pub fn new<I>(head: Head, slice: I) -> Self where
    I: IntoIterator<Item = SliceItem>,
    I::IntoIter: ExactSizeIterator
[src]

Create a new atomically reference counted ThinData with the given head and slice.

Panics

Panics if the slice iterator incorrectly reports its length.

Note on allocation

This currently creates a ThinBox first and then moves that into an Arc. This is required, because the heap layout of Arc is not stable, and custom DSTs need to be manually allocated.

This will be eliminated in the future if/when the reference counted heap layout is stabilized.

Trait Implementations

impl<Head, SliceItem> Clone for ThinArc<Head, SliceItem> where
    Arc<ThinData<Head, SliceItem>>: Clone
[src]

impl<Head, SliceItem> Debug for ThinArc<Head, SliceItem> where
    Arc<ThinData<Head, SliceItem>>: Debug
[src]

impl<Head, SliceItem> Deref for ThinArc<Head, SliceItem> where
    Arc<ThinData<Head, SliceItem>>: Deref
[src]

type Target = ThinData<Head, SliceItem>

The resulting type after dereferencing.

impl<Head, SliceItem> DerefMut for ThinArc<Head, SliceItem> where
    Arc<ThinData<Head, SliceItem>>: DerefMut
[src]

impl<Head, SliceItem> Drop for ThinArc<Head, SliceItem>[src]

impl<Head, SliceItem> Eq for ThinArc<Head, SliceItem> where
    Arc<ThinData<Head, SliceItem>>: Eq
[src]

impl<Head, SliceItem> From<Arc<ThinData<Head, SliceItem>>> for ThinArc<Head, SliceItem>[src]

impl<Head, SliceItem> From<ThinArc<Head, SliceItem>> for Arc<ThinData<Head, SliceItem>>[src]

impl<Head, SliceItem> Hash for ThinArc<Head, SliceItem> where
    Arc<ThinData<Head, SliceItem>>: Hash
[src]

impl<Head, SliceItem> PartialEq<Arc<ThinData<Head, SliceItem>>> for ThinArc<Head, SliceItem> where
    Arc<ThinData<Head, SliceItem>>: PartialEq
[src]

impl<Head, SliceItem> PartialEq<ThinArc<Head, SliceItem>> for ThinArc<Head, SliceItem> where
    Arc<ThinData<Head, SliceItem>>: PartialEq
[src]

impl<Head, SliceItem> Send for ThinArc<Head, SliceItem> where
    Arc<ThinData<Head, SliceItem>>: Send
[src]

impl<Head, SliceItem> Sync for ThinArc<Head, SliceItem> where
    Arc<ThinData<Head, SliceItem>>: Sync
[src]

Auto Trait Implementations

impl<Head, SliceItem> Unpin for ThinArc<Head, SliceItem>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.