Struct cancel_safe_futures::coop_cancel::Canceler
source · pub struct Canceler<T> { /* private fields */ }
Available on crate feature
std
only.Expand description
A cooperative cancellation sender.
For more information, see the module documentation.
Implementations§
source§impl<T> Canceler<T>
impl<T> Canceler<T>
sourcepub fn cancel(&self, message: T) -> Result<Waiter<T>, T>
pub fn cancel(&self, message: T) -> Result<Waiter<T>, T>
Performs a cancellation with a message.
This sends the message immediately, and returns a Waiter
that can be optionally waited
against to block until the corresponding Receiver
is dropped.
Only the first message ever sent via any Canceler
is received by the Receiver
.
Returns Err(message)
if the corresponding Receiver
has already been dropped, which
means that the cancel operation failed.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Canceler<T>
impl<T> RefUnwindSafe for Canceler<T>
impl<T> Send for Canceler<T>where
T: Send,
impl<T> Sync for Canceler<T>where
T: Send,
impl<T> Unpin for Canceler<T>
impl<T> UnwindSafe for Canceler<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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)