pub fn read_threaded<F>(&self, callback: F)
    where
        F: 'static + Send + FnOnce(Result<image::ImageBuffer<image::Rgba<u8>, Vec<u8>>, ()>),
    {
        let mut guard = self
            .thread_pool
            .lock()
            .expect("failed to acquire thread handle");
        let thread_pool = guard.get_or_insert_with(|| {
            let thread_pool = self
                .num_threads
                .map(|n| ThreadPool::new(n))
                .unwrap_or_default();
            Arc::new(thread_pool)
        });
        let thread_pool = thread_pool.clone();
        self.read(move |result| {
            let result = result.map(|img| img.to_owned());
            thread_pool.execute(|| callback(result));
        });
    }
/// Similar to `read`, but rather than delivering the mapped memory directly to the callback,
/// this method will first clone the mapped data, send it to another thread and then call the
/// callback from the other thread.
///
/// This is useful when the callback performs an operation that could take a long or unknown
/// amount of time (e.g. writing the image to disk).
///
/// Note however that if this method is called repeatedly (e.g. every frame) and the given
/// callback takes longer than the interval between calls, then the underlying thread will fall
/// behind and may take a while to complete by the time the application has exited.
Similar to `read`, but rather than delivering the mapped memory directly to the callback,
this method will first clone the mapped data, send it to another thread and then call the
callback from the other thread.

This is useful when the callback performs an operation that could take a long or unknown
amount of time .

Note however that if this method is called repeatedly  and the given
callback takes longer than the interval between calls, then the underlying thread will fall
behind and may take a while to complete by the time the application has exited.
Similar to ` read ` but rather than delivering the mapped memory directly to the callback this method will first clone the mapped data send it to another thread and then call the callback from the other thread . This is useful when the callback performs an operation that could take a long or unknown amount of time . Note however that if this method is called repeatedly and the given callback takes longer than the interval between calls then the underlying thread will fall behind and may take a while to complete by the time the application has exited .
pub fn read_threaded<F>(&self, callback: F)
    where
        F: 'static + Send + FnOnce(Result<image::ImageBuffer<image::Rgba<u8>, Vec<u8>>, ()>),
    {
        let mut guard = self
            .thread_pool
            .lock()
            .expect("failed to acquire thread handle");
        let thread_pool = guard.get_or_insert_with(|| {
            let thread_pool = self
                .num_threads
                .map(|n| ThreadPool::new(n))
                .unwrap_or_default();
            Arc::new(thread_pool)
        });
        let thread_pool = thread_pool.clone();
        self.read(move |result| {
            let result = result.map(|img| img.to_owned());
            thread_pool.execute(|| callback(result));
        });
    }
pub fn read_threaded < F > ( & self , callback : F ) where F : ' static + Send + FnOnce ( Result < image :: ImageBuffer < image :: Rgba < u8 > , Vec < u8 > > , ( ) > ) , { let mut guard = self . thread_pool . lock ( ) . expect ( " " ) ; let thread_pool = guard . get_or_insert_with ( | | { let thread_pool = self . num_threads . map ( | n | ThreadPool :: new ( n ) ) . unwrap_or_default ( ) ; Arc :: new ( thread_pool ) } ) ; let thread_pool = thread_pool . clone ( ) ; self . read ( move | result | { let result = result . map ( | img | img . to_owned ( ) ) ; thread_pool . execute ( | | callback ( result ) ) ; } ) ; }
Similar to `read`, but rather than delivering the mapped memory directly to the callback,
this method will first clone the mapped data, send it to another thread and then call the
callback from the other thread.
Similar to ` read ` but rather than delivering the mapped memory directly to the callback this method will first clone the mapped data send it to another thread and then call the callback from the other thread .
&self
callback
F
&self
callback
F