[−][src]Struct sync_tokens::cancelation_token::Cancelable
Assists in canceling an asynchronous operation. Typically, this struct is kept private and
used with either allow_cancel()
or Self::future()
. A CancelationToken
is given to whoever can
cancel operations
See example at sync-tokens
Implementations
impl Cancelable
[src]
pub async fn allow_cancel<TFuture, T, '_>(
&'_ self,
future: TFuture,
canceled_result: T
) -> T where
TFuture: Future<Output = T> + Unpin,
[src]
&'_ self,
future: TFuture,
canceled_result: T
) -> T where
TFuture: Future<Output = T> + Unpin,
Allows canceling the future. canceled_result is what's returned when the CancelationToken
is canceled. It is reccomended that the future return a Result
so that canceled_result
can be an error
pub fn future(&self) -> CancelationTokenFutureⓘNotable traits for CancelationTokenFuture
impl Future for CancelationTokenFuture type Output = ();
[src]
Notable traits for CancelationTokenFuture
impl Future for CancelationTokenFuture type Output = ();
Returns a future that returns once the CancelationToken
is canceled. Intended for use
with select
Trait Implementations
impl Clone for Cancelable
[src]
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Cancelable
[src]
Auto Trait Implementations
impl RefUnwindSafe for Cancelable
impl Send for Cancelable
impl Sync for Cancelable
impl Unpin for Cancelable
impl UnwindSafe for Cancelable
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,