Struct pooled_writer::Pool
source · [−]pub struct Pool { /* private fields */ }Expand description
A Pool orchestrates two different threadpools, a compressor pool and a writer pool.
The pool is suitable for scenarios where there are many more writers than threads, efficiently managing resources for M writers to N threads.
Implementations
sourceimpl Pool
impl Pool
sourcepub fn new<W, C>(
num_writer_threads: usize,
num_compressor_threads: usize,
compression_level: u8,
writers: Vec<W>
) -> Result<(Self, Vec<PooledWriter>), PoolError> where
W: Write + Send + 'static,
C: Compressor,
pub fn new<W, C>(
num_writer_threads: usize,
num_compressor_threads: usize,
compression_level: u8,
writers: Vec<W>
) -> Result<(Self, Vec<PooledWriter>), PoolError> where
W: Write + Send + 'static,
C: Compressor,
Create a running pool along with an associated set of pooled_writers.
Arguments
num_writer_threads- The number of writer threads to use in the writer pool.num_compressor_threads- The number of compressor threads to use in the compressor pool.compression_level- The compression level to use for theCompressorpool.writers- The writers to exchange forPooledWriters.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Pool
impl Send for Pool
impl Sync for Pool
impl Unpin for Pool
impl !UnwindSafe for Pool
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more