pub struct ThinBox<T: ?Sized> { /* private fields */ }Expand description
ThinBox.
A thin pointer for heap allocation, regardless of T.
Examples
#![feature(thin_box)]
use std::boxed::ThinBox;
let five = ThinBox::new(5);
let thin_slice = ThinBox::<[i32]>::new_unsize([1, 2, 3, 4]);
use std::mem::{size_of, size_of_val};
let size_of_ptr = size_of::<*const ()>();
assert_eq!(size_of_ptr, size_of_val(&five));
assert_eq!(size_of_ptr, size_of_val(&thin_slice));Implementations
Trait Implementations
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for ThinBox<T> where
    T: RefUnwindSafe,
    <T as Pointee>::Metadata: RefUnwindSafe, 
impl<T> !Send for ThinBox<T>
impl<T> !Sync for ThinBox<T>
impl<T: ?Sized> Unpin for ThinBox<T> where
    T: Unpin, 
impl<T: ?Sized> UnwindSafe for ThinBox<T> where
    T: UnwindSafe,
    <T as Pointee>::Metadata: UnwindSafe, 
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
    T: ?Sized, 
 
impl<T> BorrowMut<T> for T where
    T: ?Sized, 
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more