pub struct Permit<'a, T> { /* private fields */ }Expand description
Room for one message, reserved before the message exists.
The send through it never waits and never fails, even when the receiver was closed in the meantime. Dropping it without sending gives the slot back.
use nuclei::sync::local::mpsc;
let (tx, mut rx) = mpsc::channel(1);
let permit = tx.try_reserve().unwrap();
permit.send("reserved");
assert_eq!(rx.try_recv(), Ok("reserved"));Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for Permit<'a, T>
impl<'a, T> !Send for Permit<'a, T>
impl<'a, T> !Sync for Permit<'a, T>
impl<'a, T> !UnwindSafe for Permit<'a, T>
impl<'a, T> Freeze for Permit<'a, T>
impl<'a, T> Unpin for Permit<'a, T>
impl<'a, T> UnsafeUnpin for Permit<'a, 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