pub fn initialize(
        config: Arc<Configuration>,
        tx_stats: CommandSender,
    ) -> (Joiner, TermOutHandle) {
        log::trace!("enter: initialize({:?}, {:?})", config, tx_stats);

        let (tx_term, rx_term) = mpsc::unbounded_channel::<Command>();
        let (tx_file, rx_file) = mpsc::unbounded_channel::<Command>();

        let mut file_handler = FileOutHandler::new(rx_file, config.clone());

        let tx_stats_clone = tx_stats.clone();

        let file_task = if !config.output.is_empty() {
            // -o used, need to spawn the thread for writing to disk
            Some(tokio::spawn(async move {
                file_handler.start(tx_stats_clone).await
            }))
        } else {
            None
        };

        let mut term_handler = Self::new(rx_term, tx_file.clone(), file_task, config);
        let term_task = tokio::spawn(async move { term_handler.start(tx_stats).await });

        let event_handle = TermOutHandle::new(tx_term, tx_file);

        log::trace!("exit: initialize -> ({:?}, {:?})", term_task, event_handle);

        (term_task, event_handle)
    }
/// Creates all required output handlers (terminal, file) and updates the given Handles/Tasks
Creates all required output handlers (terminal, file) and updates the given Handles/Tasks
Creates all required output handlers ( terminal file ) and updates the given Handles / Tasks
pub fn initialize(
        config: Arc<Configuration>,
        tx_stats: CommandSender,
    ) -> (Joiner, TermOutHandle) {
        log::trace!("enter: initialize({:?}, {:?})", config, tx_stats);
        let (tx_term, rx_term) = mpsc::unbounded_channel::<Command>();
        let (tx_file, rx_file) = mpsc::unbounded_channel::<Command>();
        let mut file_handler = FileOutHandler::new(rx_file, config.clone());
        let tx_stats_clone = tx_stats.clone();
        let file_task = if !config.output.is_empty() {
            // -o used, need to spawn the thread for writing to disk
            Some(tokio::spawn(async move {
                file_handler.start(tx_stats_clone).await
            }))
        } else {
            None
        };
        let mut term_handler = Self::new(rx_term, tx_file.clone(), file_task, config);
        let term_task = tokio::spawn(async move { term_handler.start(tx_stats).await });
        let event_handle = TermOutHandle::new(tx_term, tx_file);
        log::trace!("exit: initialize -> ({:?}, {:?})", term_task, event_handle);
        (term_task, event_handle)
    }
pub fn initialize ( config : Arc < Configuration > , tx_stats : CommandSender , ) -> ( Joiner , TermOutHandle ) { log :: trace ! ( " " config tx_stats ) ; let ( tx_term , rx_term ) = mpsc :: unbounded_channel :: < Command > ( ) ; let ( tx_file , rx_file ) = mpsc :: unbounded_channel :: < Command > ( ) ; let mut file_handler = FileOutHandler :: new ( rx_file , config . clone ( ) ) ; let tx_stats_clone = tx_stats . clone ( ) ; let file_task = if ! config . output . is_empty ( ) { // -o used, need to spawn the thread for writing to disk Some ( tokio :: spawn ( async move { file_handler . start ( tx_stats_clone ) . await } ) ) } else { None } ; let mut term_handler = Self :: new ( rx_term , tx_file . clone ( ) , file_task , config ) ; let term_task = tokio :: spawn ( async move { term_handler . start ( tx_stats ) . await } ) ; let event_handle = TermOutHandle :: new ( tx_term , tx_file ) ; log :: trace ! ( " " term_task event_handle ) ; ( term_task , event_handle ) }
Creates all required output handlers (terminal, file) and updates the given Handles/Tasks
Creates all required output handlers ( terminal file ) and updates the given Handles / Tasks
config
Arc<Configuration>
tx_stats
CommandSender