Struct exr::block::writer::ParallelBlocksCompressor

source ·
pub struct ParallelBlocksCompressor<'w, W> {
    meta: &'w MetaData,
    sorted_writer: SortedBlocksWriter<'w, W>,
    sender: Sender<Result<(usize, usize, Chunk)>>,
    receiver: Receiver<Result<(usize, usize, Chunk)>>,
    pool: ThreadPool,
    currently_compressing_count: usize,
    written_chunk_count: usize,
    max_threads: usize,
    next_incoming_chunk_index: usize,
}
Expand description

Compress blocks to a chunk writer with multiple threads.

Fields§

§meta: &'w MetaData§sorted_writer: SortedBlocksWriter<'w, W>§sender: Sender<Result<(usize, usize, Chunk)>>§receiver: Receiver<Result<(usize, usize, Chunk)>>§pool: ThreadPool§currently_compressing_count: usize§written_chunk_count: usize§max_threads: usize§next_incoming_chunk_index: usize

Implementations§

source§

impl<'w, W> ParallelBlocksCompressor<'w, W>
where W: 'w + ChunksWriter,

source

pub fn new(meta: &'w MetaData, chunks_writer: &'w mut W) -> Option<Self>

New blocks writer. Returns none if sequential compression should be used. Use new_with_thread_pool to customize the threadpool.

source

pub fn new_with_thread_pool<CreatePool>( meta: &'w MetaData, chunks_writer: &'w mut W, try_create_thread_pool: CreatePool, ) -> Option<Self>
where CreatePool: FnOnce() -> Result<ThreadPool, ThreadPoolBuildError>,

New blocks writer. Returns none if sequential compression should be used.

source

pub fn inner_chunks_writer(&'w self) -> &'w W

This is where the compressed blocks are written to.

source

fn write_next_queued_chunk(&mut self) -> UnitResult

source

pub fn write_all_queued_chunks(&mut self) -> UnitResult

Wait until all currently compressing chunks in the compressor have been written.

source

pub fn add_block_to_compression_queue( &mut self, index_in_header_increasing_y: usize, block: UncompressedBlock, ) -> UnitResult

Add a single block to the compressor queue. The index of the block must be in increasing line order. When calling this function for the last block, this method waits until all the blocks have been written. This only works when you write as many blocks as the image expects, otherwise you can use wait_for_all_remaining_chunks. Waits for a block from the queue to be written, if the queue already has enough items.

Trait Implementations§

source§

impl<'w, W: Debug> Debug for ParallelBlocksCompressor<'w, W>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'w, W> Freeze for ParallelBlocksCompressor<'w, W>

§

impl<'w, W> !RefUnwindSafe for ParallelBlocksCompressor<'w, W>

§

impl<'w, W> Send for ParallelBlocksCompressor<'w, W>
where W: Send,

§

impl<'w, W> !Sync for ParallelBlocksCompressor<'w, W>

§

impl<'w, W> Unpin for ParallelBlocksCompressor<'w, W>

§

impl<'w, W> !UnwindSafe for ParallelBlocksCompressor<'w, W>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.