You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: future_ext.rs
    path of file: ./repos/h2/tests/h2-support/src
    
    the code of the file until where you have to start completion: use futures::FutureExt;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};

/// Future extension helpers that are useful for tests
pub trait TestFuture: Future {
    /// Drive `other` by polling `self`.
    ///
    /// `self` must not resolve before `other` does.
    fn drive<T>(&mut self, other: T) -> Drive<'_, Self, T>
    where
        T: Future,
        Self: Future + Sized,
    {
        Drive {
            driver: self,
            future: Box::pin(other),
        }
    }
}

impl<T: Future> TestFuture for T {}

// ===== Drive ======

/// Drive a future to completion while also polling the driver
///
/// This is useful 
    
    fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
        let mut looped = false;
        loop {
            match self.future.poll_unpin(cx) {
                Poll::Ready(val) => return Poll::Ready(val),
                Poll::Pending => {}
            }

            match self.driver.poll_unpin(cx) {
                Poll::Ready(_) => {
                    if looped {
                        // Try polling the future one last time
                        panic!("driver resolved before future")
                    } else {
                        looped = true;
                        continue;
                    }
                }
                Poll::Pending => {}
            }

            return Poll::Pending;
        }
    }