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: tournament_tree.rs
    path of file: ./repos/pgvecto.rs/crates/service/src/utils
    
    the code of the file until where you have to start completion: use std::cmp::Reverse;

pub struct LoserTree<I, T> {
    // 0..n
    iterators: Vec<I>,
    // 0..m
    x: Vec<Option<Reverse<T>>>,
    // 0..m, m = (winner: 1) + (losers: 2 ^ 0 + 2 ^ 1 + 2 ^ 2 + 2 ^ 3 + ... + 2 ^ (k - 1))
    losers: Vec<usize>,
}

impl<I> LoserTree<I, I::Item>
where
    I: Iterator,
    I::Item: Ord,
{
    pub fn new(mut iterators: Vec<I>) -> Self {
        let n = iterators.len();
        let m = n.next_power_of_two();
        let mut x = Vec::new
    
    fn next(&mut self) -> Option<Self::Item> {
        let n = self.iterators.len();
        let m = n.next_power_of_two();
        let r = self.losers[0];
        let Reverse(result) = self.x[r].take()?;
        self.x[r] = self.iterators[r].next().map(Reverse);
        let mut v = r;
        let mut i = (m + r) >> 1;
        while i != 0 {
            if self.x[v] < self.x[self.losers[i]] {
                std::mem::swap(&mut v, &mut self.losers[i]);
            }
            i >>= 1;
        }
        self.losers[0] = v;
        Some(result)
    }