pub struct Unique<T: ?Sized, A: Allocator = GlobalAllocator> { /* private fields */ }
Expand description
An allocator-aware smart pointer similar to C++’s unique_ptr
.
§Usage
let pointer = Unique::new(100_000);
let num = *pointer;
TODO: Write better documentation.
Implementations§
Trait Implementations§
Source§impl<T: ?Sized, A: Allocator> BorrowMut<T> for Unique<T, A>
impl<T: ?Sized, A: Allocator> BorrowMut<T> for Unique<T, A>
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Unique<U, A>> for Unique<T, A>
impl<T: ?Sized, A: Allocator> Unpin for Unique<T, A>
Auto Trait Implementations§
impl<T, A> Freeze for Unique<T, A>
impl<T, A> RefUnwindSafe for Unique<T, A>
impl<T, A = GlobalAllocator> !Send for Unique<T, A>
impl<T, A = GlobalAllocator> !Sync for Unique<T, A>
impl<T, A> UnwindSafe for Unique<T, A>
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