pub struct ThinRc<Head, SliceItem> { /* private fields */ }Expand description
A thin version of Rc.
Implementations§
Source§impl<Head, SliceItem> ThinRc<Head, SliceItem>
impl<Head, SliceItem> ThinRc<Head, SliceItem>
Sourcepub unsafe fn from_erased(ptr: ErasedPtr) -> Self
pub unsafe fn from_erased(ptr: ErasedPtr) -> Self
Construct an owned pointer from an erased pointer.
§Safety
This pointer must logically own a valid instance of Self.
Source§impl<Head, SliceItem> ThinRc<Head, SliceItem>
impl<Head, SliceItem> ThinRc<Head, SliceItem>
Sourcepub fn new<I>(head: Head, slice: I) -> Self
pub fn new<I>(head: Head, slice: I) -> Self
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§
Source§impl<Head, SliceItem> PartialEq<Rc<ThinData<Head, SliceItem>>> for ThinRc<Head, SliceItem>
impl<Head, SliceItem> PartialEq<Rc<ThinData<Head, SliceItem>>> for ThinRc<Head, SliceItem>
impl<Head, SliceItem> Eq for ThinRc<Head, SliceItem>
impl<Head, SliceItem> Send for ThinRc<Head, SliceItem>
impl<Head, SliceItem> Sync for ThinRc<Head, SliceItem>
Auto Trait Implementations§
impl<Head, SliceItem> Freeze for ThinRc<Head, SliceItem>
impl<Head, SliceItem> RefUnwindSafe for ThinRc<Head, SliceItem>where
Head: RefUnwindSafe,
SliceItem: RefUnwindSafe,
impl<Head, SliceItem> Unpin for ThinRc<Head, SliceItem>
impl<Head, SliceItem> UnwindSafe for ThinRc<Head, SliceItem>where
Head: RefUnwindSafe,
SliceItem: RefUnwindSafe,
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