pub fn with_current_cancellation_token<R>(func: impl FnOnce(&dyn CancellationToken) -> R) -> R {
    CURRENT_CANCELLATION_TOKEN.with(|token| {
        let x = &*token.borrow();
        match x {
            Some(token) => func(*token),
            None => func(&UncancellableToken::default()),
        }
    })
}
/// Executes a function that gets access to the current cancellation token
Executes a function that gets access to the current cancellation token
Executes a function that gets access to the current cancellation token
pub fn with_current_cancellation_token<R>(func: impl FnOnce(&dyn CancellationToken) -> R) -> R {
    CURRENT_CANCELLATION_TOKEN.with(|token| {
        let x = &*token.borrow();
        match x {
            Some(token) => func(*token),
            None => func(&UncancellableToken::default()),
        }
    })
}
pub fn with_current_cancellation_token < R > ( func : impl FnOnce ( & dyn CancellationToken ) -> R ) -> R { CURRENT_CANCELLATION_TOKEN . with ( | token | { let x = & * token . borrow ( ) ; match x { Some ( token ) => func ( * token ) , None => func ( & UncancellableToken :: default ( ) ) , } } ) }
Executes a function that gets access to the current cancellation token
Executes a function that gets access to the current cancellation token
func
impl FnOnce(&dyn CancellationToken) -> R
func
impl FnOnce(&dyn CancellationToken) -> R