[][src]Struct thin_dst::ThinRc

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

A thin version of Rc.

Methods

impl<Head, SliceItem> ThinRc<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> ThinRc<Head, SliceItem>[src]

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

Create a new 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 Rc. This is required, because the heap layout of Rc 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 ThinRc<Head, SliceItem> where
    Rc<ThinData<Head, SliceItem>>: Clone
[src]

impl<Head, SliceItem> Debug for ThinRc<Head, SliceItem> where
    Rc<ThinData<Head, SliceItem>>: Debug
[src]

impl<Head, SliceItem> Deref for ThinRc<Head, SliceItem> where
    Rc<ThinData<Head, SliceItem>>: Deref
[src]

type Target = ThinData<Head, SliceItem>

The resulting type after dereferencing.

impl<Head, SliceItem> DerefMut for ThinRc<Head, SliceItem> where
    Rc<ThinData<Head, SliceItem>>: DerefMut
[src]

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

impl<Head, SliceItem> Eq for ThinRc<Head, SliceItem> where
    Rc<ThinData<Head, SliceItem>>: Eq
[src]

impl<Head, SliceItem> From<Rc<ThinData<Head, SliceItem>>> for ThinRc<Head, SliceItem>[src]

impl<Head, SliceItem> From<ThinRc<Head, SliceItem>> for Rc<ThinData<Head, SliceItem>>[src]

impl<Head, SliceItem> Hash for ThinRc<Head, SliceItem> where
    Rc<ThinData<Head, SliceItem>>: Hash
[src]

impl<Head, SliceItem> PartialEq<Rc<ThinData<Head, SliceItem>>> for ThinRc<Head, SliceItem> where
    Rc<ThinData<Head, SliceItem>>: PartialEq
[src]

impl<Head, SliceItem> PartialEq<ThinRc<Head, SliceItem>> for ThinRc<Head, SliceItem> where
    Rc<ThinData<Head, SliceItem>>: PartialEq
[src]

impl<Head, SliceItem> Send for ThinRc<Head, SliceItem> where
    Rc<ThinData<Head, SliceItem>>: Send
[src]

impl<Head, SliceItem> Sync for ThinRc<Head, SliceItem> where
    Rc<ThinData<Head, SliceItem>>: Sync
[src]

Auto Trait Implementations

impl<Head, SliceItem> Unpin for ThinRc<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.