async fn start(&mut self, tx_stats: CommandSender) -> Result<()> {
        log::trace!("enter: start_file_handler({:?})", tx_stats);

        let mut file = open_file(&self.config.output)?;

        log::info!("Writing scan results to {}", self.config.output);

        while let Some(command) = self.receiver.recv().await {
            match command {
                Command::Report(response) => {
                    skip_fail!(write_to(&*response, &mut file, self.config.json));
                }
                Command::Exit => {
                    break;
                }
                Command::Sync(sender) => {
                    skip_fail!(sender.send(true));
                }
                _ => {} // no more needed
            }
        }

        // close the file before we tell statistics to save current data to the same file
        drop(file);

        send_command!(tx_stats, Command::Save);

        log::trace!("exit: start_file_handler");
        Ok(())
    }
/// Spawn a single consumer task (sc side of mpsc)
///
/// The consumer simply receives responses from the terminal handler and writes them to disk
Spawn a single consumer task (sc side of mpsc)
The consumer simply receives responses from the terminal handler and writes them to disk
Spawn a single consumer task ( sc side of mpsc ) The consumer simply receives responses from the terminal handler and writes them to disk
async fn start(&mut self, tx_stats: CommandSender) -> Result<()> {
        log::trace!("enter: start_file_handler({:?})", tx_stats);
        let mut file = open_file(&self.config.output)?;
        log::info!("Writing scan results to {}", self.config.output);
        while let Some(command) = self.receiver.recv().await {
            match command {
                Command::Report(response) => {
                    skip_fail!(write_to(&*response, &mut file, self.config.json));
                }
                Command::Exit => {
                    break;
                }
                Command::Sync(sender) => {
                    skip_fail!(sender.send(true));
                }
                _ => {} // no more needed
            }
        }
        // close the file before we tell statistics to save current data to the same file
        drop(file);
        send_command!(tx_stats, Command::Save);
        log::trace!("exit: start_file_handler");
        Ok(())
    }
async fn start ( & mut self , tx_stats : CommandSender ) -> Result < ( ) > { log :: trace ! ( " " tx_stats ) ; let mut file = open_file ( & self . config . output ) ? ; log :: info ! ( " " self config output ) ; while let Some ( command ) = self . receiver . recv ( ) . await { match command { Command :: Report ( response ) => { skip_fail ! ( write_to ( response mut file self config json ) ) ; } Command :: Exit => { break ; } Command :: Sync ( sender ) => { skip_fail ! ( sender send ( true ) ) ; } _ => { } // no more needed } } // close the file before we tell statistics to save current data to the same file drop ( file ) ; send_command ! ( tx_stats Command Save ) ; log :: trace ! ( " " ) ; Ok ( ( ) ) }
Spawn a single consumer task (sc side of mpsc)
The consumer simply receives responses from the terminal handler and writes them to disk
Spawn a single consumer task ( sc side of mpsc ) The consumer simply receives responses from the terminal handler and writes them to disk
&mut self
tx_stats
CommandSender