pub struct SharedVecRef<T> { /* private fields */ }Expand description
A reference to SharedVec that can be sent to other threads.
Dropping a SharedVecRef leaks the heap allocation it points to.
When the panic-on-drop feature is enabled, dropping it will panic:
ⓘ
let mut values = manual_share::SharedVec::from_vec(vec![1]);
values.borrow();
// forget SharedVecMut to make sure the panic is not caused by dropping it first.
std::mem::forget(values);
// panic here due to dropping ShareVecRefUse SharedVec::try_return to consume it without causing panic.
let mut values = manual_share::SharedVec::from_vec(vec![1]);
let reference = values.borrow();
values.try_return(reference).unwrap();Implementations§
Trait Implementations§
Auto Trait Implementations§
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