Struct ParallelBlocksCompressor

#[must_use]
pub struct ParallelBlocksCompressor<'w, W> { /* private fields */ }

Compress blocks to a chunk writer with multiple threads.

Implementations

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

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.

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.

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

This is where the compressed blocks are written to.

fn write_all_queued_chunks(&mut self) -> UnitResult

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

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

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

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

Auto Trait Implementations

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

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

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

impl<'w, W> Freeze for ParallelBlocksCompressor<'w, W> where SortedBlocksWriter<'w, W>: Freeze,

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

impl<'w, W> Unpin for ParallelBlocksCompressor<'w, W> where SortedBlocksWriter<'w, W>: Unpin,

impl<'w, W> UnsafeUnpin for ParallelBlocksCompressor<'w, W> where SortedBlocksWriter<'w, W>: UnsafeUnpin,

Blanket Implementations

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for ParallelBlocksCompressor<'w, W> where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for ParallelBlocksCompressor<'w, W> where ST: ?Sized, DT: ?Sized,

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for ParallelBlocksCompressor<'w, W> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for ParallelBlocksCompressor<'w, W> where T: ?Sized,

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

impl<T> From<T> for ParallelBlocksCompressor<'w, W>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Pointable for ParallelBlocksCompressor<'w, W>

const ALIGN: usize = _;
type Init = T;
unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)

impl<T> Read<Exclusive, BecauseExclusive> for ParallelBlocksCompressor<'w, W> where T: ?Sized,

impl<T, U> Into<U> for ParallelBlocksCompressor<'w, W> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom<U> for ParallelBlocksCompressor<'w, W> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for ParallelBlocksCompressor<'w, W> where U: TryFrom<T>,

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