fn generate_cache_for_results(vector_with_path: Vec<(String, String, TreePath)>) -> Vec<(String, String, Image, Image, TreePath)> {
    // TODO use here threads,
    // For now threads cannot be used because Image and TreeIter cannot be used in threads
    let mut cache_all_images = Vec::new();
    for (full_path, name, tree_path) in vector_with_path {
        let small_img = Image::new();
        let big_img = Image::new();

        match Pixbuf::from_file(&full_path) {
            Ok(pixbuf) =>
            {
                #[allow(clippy::never_loop)]
                loop {
                    let pixbuf_big = match resize_pixbuf_dimension(pixbuf, (BIG_PREVIEW_SIZE, BIG_PREVIEW_SIZE), InterpType::Nearest) {
                        None => {
                            println!("Failed to resize image {}.", full_path);
                            break;
                        }
                        Some(pixbuf) => pixbuf,
                    };
                    let pixbuf_small = match resize_pixbuf_dimension(pixbuf_big.clone(), (SMALL_PREVIEW_SIZE, SMALL_PREVIEW_SIZE), InterpType::Nearest) {
                        None => {
                            println!("Failed to resize image {}.", full_path);
                            break;
                        }
                        Some(pixbuf) => pixbuf,
                    };

                    big_img.set_from_pixbuf(Some(&pixbuf_big));
                    small_img.set_from_pixbuf(Some(&pixbuf_small));
                    break;
                }
            }
            Err(e) => {
                println!("Failed to open image {}, reason {}", full_path, e);
            }
        };

        cache_all_images.push((full_path, name, big_img, small_img, tree_path));
    }
    cache_all_images
}
/// Generate images which will be used later as preview images without needing to open them again and again
Generate images which will be used later as preview images without needing to open them again and again
Generate images which will be used later as preview images without needing to open them again and again
fn generate_cache_for_results(vector_with_path: Vec<(String, String, TreePath)>) -> Vec<(String, String, Image, Image, TreePath)> {
    // TODO use here threads,
    // For now threads cannot be used because Image and TreeIter cannot be used in threads
    let mut cache_all_images = Vec::new();
    for (full_path, name, tree_path) in vector_with_path {
        let small_img = Image::new();
        let big_img = Image::new();
        match Pixbuf::from_file(&full_path) {
            Ok(pixbuf) =>
            {
                #[allow(clippy::never_loop)]
                loop {
                    let pixbuf_big = match resize_pixbuf_dimension(pixbuf, (BIG_PREVIEW_SIZE, BIG_PREVIEW_SIZE), InterpType::Nearest) {
                        None => {
                            println!("Failed to resize image {}.", full_path);
                            break;
                        }
                        Some(pixbuf) => pixbuf,
                    };
                    let pixbuf_small = match resize_pixbuf_dimension(pixbuf_big.clone(), (SMALL_PREVIEW_SIZE, SMALL_PREVIEW_SIZE), InterpType::Nearest) {
                        None => {
                            println!("Failed to resize image {}.", full_path);
                            break;
                        }
                        Some(pixbuf) => pixbuf,
                    };
                    big_img.set_from_pixbuf(Some(&pixbuf_big));
                    small_img.set_from_pixbuf(Some(&pixbuf_small));
                    break;
                }
            }
            Err(e) => {
                println!("Failed to open image {}, reason {}", full_path, e);
            }
        };
        cache_all_images.push((full_path, name, big_img, small_img, tree_path));
    }
    cache_all_images
}
fn generate_cache_for_results ( vector_with_path : Vec < ( String , String , TreePath ) > ) -> Vec < ( String , String , Image , Image , TreePath ) > { // TODO use here threads, // For now threads cannot be used because Image and TreeIter cannot be used in threads let mut cache_all_images = Vec :: new ( ) ; for ( full_path , name , tree_path ) in vector_with_path { let small_img = Image :: new ( ) ; let big_img = Image :: new ( ) ; match Pixbuf :: from_file ( & full_path ) { Ok ( pixbuf ) => { # [ allow ( clippy never_loop ) ] loop { let pixbuf_big = match resize_pixbuf_dimension ( pixbuf , ( BIG_PREVIEW_SIZE , BIG_PREVIEW_SIZE ) , InterpType :: Nearest ) { None => { println ! ( " " full_path ) ; break ; } Some ( pixbuf ) => pixbuf , } ; let pixbuf_small = match resize_pixbuf_dimension ( pixbuf_big . clone ( ) , ( SMALL_PREVIEW_SIZE , SMALL_PREVIEW_SIZE ) , InterpType :: Nearest ) { None => { println ! ( " " full_path ) ; break ; } Some ( pixbuf ) => pixbuf , } ; big_img . set_from_pixbuf ( Some ( & pixbuf_big ) ) ; small_img . set_from_pixbuf ( Some ( & pixbuf_small ) ) ; break ; } } Err ( e ) => { println ! ( " " full_path e ) ; } } ; cache_all_images . push ( ( full_path , name , big_img , small_img , tree_path ) ) ; } cache_all_images }
Generate images which will be used later as preview images without needing to open them again and again
Generate images which will be used later as preview images without needing to open them again and again
vector_with_path
Vec<(String, String, TreePath)>
vector_with_path
Vec<(String, String, TreePath)>