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: connect_progress_receiver.rs
    path of file: ./repos/czkawka/krokiet/src
    
    the code of the file until where you have to start completion: use std::thread;

use crossbeam_channel::Receiver;
use slint::ComponentHandle;

use czkawka_core::common_dir_traversal::{CheckingMethod, ProgressData, ToolType};

use crate::{MainWindow, ProgressToSend};

pub fn connect_progress_gathering(app: &MainWindow, progress_receiver: Receiver<ProgressData>) {
    let a = app.as_weak();

    thread::spawn(move || loop {
        let Ok(progress_data) = progress_receiver.recv() else {
            return; // Channel closed, so exit the thread since app closing
        };

        a.upgrade_in_event_loop(move |app| {
            let to_send = if progress_data.current_stage == 0 {
                progress_collect_items(&progress_data, progress_data.tool_type != ToolType::EmptyFolders)
            } else if check_if_loading_saving_cache(&progress_data) {
 
    
fn progress_collect_items(item: &ProgressData, files: bool) -> ProgressToSend {
    let step_name = match (item.tool_type, item.checking_method) {
        (ToolType::Duplicate, CheckingMethod::Name) => {
            format!("Scanning name of {} file", item.entries_checked)
        }
        (ToolType::Duplicate, CheckingMethod::SizeName) => {
            format!("Scanning size and name of {} file", item.entries_checked)
        }
        (ToolType::Duplicate, CheckingMethod::Size | CheckingMethod::Hash) => {
            format!("Scanning size of {} file", item.entries_checked)
        }
        _ => {
            if files {
                format!("Scanning {} file", item.entries_checked)
            } else {
                format!("Scanning {} folder", item.entries_checked)
            }
        }
    };
    let (all_progress, current_progress) = no_current_stage_get_data(item);
    ProgressToSend {
        all_progress,
        current_progress,
        step_name: step_name.into(),
    }
}