LCOV - code coverage report | ||||||||||||||||||||||
![]() | ||||||||||||||||||||||
|
||||||||||||||||||||||
![]() |
Line data Source code 1 : use std::pin::pin; 2 : 3 : use futures::future::{Either, select}; 4 : use tokio_util::sync::CancellationToken; 5 : 6 0 : pub async fn run_until_cancelled<F: Future>( 7 0 : f: F, 8 0 : cancellation_token: &CancellationToken, 9 0 : ) -> Option<F::Output> { 10 0 : match select(pin!(f), pin!(cancellation_token.cancelled())).await { 11 0 : Either::Left((f, _)) => Some(f), 12 0 : Either::Right(((), _)) => None, 13 : } 14 0 : } |
![]() |
Generated by: LCOV version 2.1-beta |