Struct bed_utils::extsort::ExternalSorterBuilder
source · 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> Pointable for T
impl<T> Pointable for T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.