pub struct ExternalSorterBuilder { /* private fields */ }Expand description
Exposes external sorting (i.e. on disk sorting) capability on arbitrarily sized iterator, even if the generated content of the iterator doesn’t fit in memory.
Implementations§
source§impl ExternalSorterBuilder
impl ExternalSorterBuilder
pub fn new() -> Self
sourcepub fn with_chunk_size(self, size: usize) -> Self
pub fn with_chunk_size(self, size: usize) -> Self
Sets the maximum size of each segment in number of sorted items.
This number of items needs to fit in memory. While sorting, a in-memory buffer is used to collect the items to be sorted. Once it reaches the maximum size, it is sorted and then written to disk.
Using a higher segment size makes sorting faster by leveraging faster in-memory operations.
sourcepub fn with_tmp_dir<P: AsRef<Path>>(self, path: P) -> Self
pub fn with_tmp_dir<P: AsRef<Path>>(self, path: P) -> Self
Sets directory in which sorted segments will be written (if it doesn’t fit in memory).
pub fn with_compression(self, level: u32) -> Self
sourcepub fn num_threads(self, num_threads: usize) -> Self
pub fn num_threads(self, num_threads: usize) -> Self
Uses Rayon to sort the in-memory buffer.
This may not be needed if the buffer isn’t big enough for parallelism to be gainful over the overhead of multithreading.
pub fn build(self) -> Result<ExternalSorter>
Auto Trait Implementations§
impl Freeze for ExternalSorterBuilder
impl RefUnwindSafe for ExternalSorterBuilder
impl Send for ExternalSorterBuilder
impl Sync for ExternalSorterBuilder
impl Unpin for ExternalSorterBuilder
impl UnwindSafe for ExternalSorterBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more