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: lifecycle.rs
    path of file: ./repos/vector/src/sources/kubernetes_logs
    
    the code of the file until where you have to start completion: use std::{
    future::Future,
    pin::Pin,
    task::{ready, Context, Poll},
};

use futures::{
    channel::oneshot,
    future::{select, BoxFuture, Either},
    pin_mut,
    stream::FuturesOrdered,
    FutureExt, StreamExt,
};

use crate::shutdown::{ShutdownSignal, ShutdownSignalToken};

/// Lifecycle encapsulates logic for managing a lifecycle of multiple futures
/// that are bounded together by a shared shutdown condition.
///
/// If any of the futures completes, or global shutdown it r
    
    pub async fn run(mut self, mut global_shutdown: ShutdownSignal) -> GlobalShutdownToken {
        let first_task_fut = self.futs.next();
        pin_mut!(first_task_fut);

        let token = match select(first_task_fut, &mut global_shutdown).await {
            Either::Left((None, _)) => {
                trace!(message = "Lifecycle had no tasks upon run, we're done.");
                GlobalShutdownToken::Unused(global_shutdown)
            }
            Either::Left((Some(()), _)) => {
                trace!(message = "Lifecycle had the first task completed.");
                GlobalShutdownToken::Unused(global_shutdown)
            }
            Either::Right((shutdown_signal_token, _)) => {
                trace!(message = "Lifecycle got a global shutdown request.");
                GlobalShutdownToken::Token(shutdown_signal_token)
            }
        };

        // Send the shutdowns to all managed futures.
        for fut_shutdown in self.fut_shutdowns {
            if fut_shutdown.send(()).is_err() {
                trace!(
                    message = "Error while sending a future shutdown, \
                        the receiver is already dropped; \
                        this is not a problem."
                );
            }
        }

        // Wait for all the futures to complete.
        while let Some(()) = self.futs.next().await {
            trace!(message = "A lifecycle-managed future completed after shutdown was requested.");
        }

        // Return the global shutdown token so that caller can perform it's
        // cleanup.
        token
    }