pub struct OneShot<T> { /* private fields */ }Expand description
A cell holding a resource until something takes it, once.
ConnectorBuilder is Send + Sync and its build takes &self, so a
connector holding a moved-in listener, peripheral or credential set must
take it through interior mutability. spin::Mutex<Option<T>> is
Send + Sync whenever T: Send, with no unsafe.
The T: Send bound is the contract: a type that is not Send cannot be
held here, and that refusal is the signal to fix the type rather than to
reach for unsafe impl.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for OneShot<T>
impl<T> !RefUnwindSafe for OneShot<T>
impl<T> Send for OneShot<T>
impl<T> Sync for OneShot<T>
impl<T> Unpin for OneShot<T>
impl<T> UnsafeUnpin for OneShot<T>
impl<T> UnwindSafe for OneShot<T>
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