/// Create a new decompressor. Does not immediately spawn any tasks.
/// Decompression starts after the first call to `next`.
/// Returns the chunks if parallel decompression should not be used.
Create a new decompressor. Does not immediately spawn any tasks.
Decompression starts after the first call to `next`.
Returns the chunks if parallel decompression should not be used.
Create a new decompressor . Does not immediately spawn any tasks . Decompression starts after the first call to ` next ` . Returns the chunks if parallel decompression should not be used .
pub fn new(chunks: R, pedantic: bool, pool: threadpool::ThreadPool) -> std::result::Result<Self, R> {
        if chunks.meta_data().headers.iter()
            .all(|head|head.compression == Compression::Uncompressed)
        {
            return Err(chunks);
        }
        let max_threads = pool.max_count().max(1).min(chunks.len()) + 2; // ca one block for each thread at all times
        let (send, recv) = flume::unbounded(); // TODO bounded channel simplifies logic?
        Ok(Self {
            shared_meta_data_ref: Arc::new(chunks.meta_data().clone()),
            currently_decompressing_count: 0,
            remaining_chunks: chunks,
            sender: send,
            receiver: recv,
            pedantic,
            max_threads,
            pool,
        })
    }
pub fn new ( chunks : R , pedantic : bool , pool : threadpool :: ThreadPool ) -> std :: result :: Result < Self , R > { if chunks . meta_data ( ) . headers . iter ( ) . all ( | head | head . compression == Compression :: Uncompressed ) { return Err ( chunks ) ; } let max_threads = pool . max_count ( ) . max ( 1 ) . min ( chunks . len ( ) ) + 2 ; // ca one block for each thread at all times let ( send , recv ) = flume :: unbounded ( ) ; // TODO bounded channel simplifies logic? Ok ( Self { shared_meta_data_ref : Arc :: new ( chunks . meta_data ( ) . clone ( ) ) , currently_decompressing_count : 0 , remaining_chunks : chunks , sender : send , receiver : recv , pedantic , max_threads , pool , } ) }
Create a new decompressor.
Create a new decompressor .
chunks
R
pedantic
bool
pool
threadpool::ThreadPool