LCOV - code coverage report
Current view: top level - proxy/src - util.rs (source / functions) Coverage Total Hit
Test: 1e20c4f2b28aa592527961bb32170ebbd2c9172f.info Lines: 0.0 % 14 0
Test Date: 2025-07-16 12:29:03 Functions: 0.0 % 10 0

            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 :     run_until(f, cancellation_token.cancelled()).await.ok()
      11            0 : }
      12              : 
      13              : /// Runs the future `f` unless interrupted by future `condition`.
      14            0 : pub async fn run_until<F1: Future, F2: Future>(
      15            0 :     f: F1,
      16            0 :     condition: F2,
      17            0 : ) -> Result<F1::Output, F2::Output> {
      18            0 :     match select(pin!(f), pin!(condition)).await {
      19            0 :         Either::Left((f1, _)) => Ok(f1),
      20            0 :         Either::Right((f2, _)) => Err(f2),
      21              :     }
      22            0 : }
        

Generated by: LCOV version 2.1-beta