pub struct ExternalSorter<T, E, B = LimitedBufferBuilder, C = RmpExternalChunk<T>>{ /* private fields */ }
Expand description
External sorter.
Implementations§
Source§impl<T, E, B, C> ExternalSorter<T, E, B, C>
impl<T, E, B, C> ExternalSorter<T, E, B, C>
Sourcepub fn new(
threads_number: Option<usize>,
tmp_path: Option<&Path>,
buffer_builder: B,
rw_buf_size: Option<usize>,
) -> Result<Self, SortError<C::SerializationError, C::DeserializationError, E>>
pub fn new( threads_number: Option<usize>, tmp_path: Option<&Path>, buffer_builder: B, rw_buf_size: Option<usize>, ) -> Result<Self, SortError<C::SerializationError, C::DeserializationError, E>>
Creates a new external sorter instance.
§Arguments
threads_number
- Number of threads to be used to sort data in parallel. If the parameter isNone
threads number will be selected based on available CPU core number.tmp_path
- Directory to be used to store temporary data. If paramater isNone
default OS temporary directory will be used.buffer_builder
- An instance of a buffer builder that will be used for chunk buffer creation.rw_buf_size
- Chunks file read/write buffer size.
Sourcepub fn sort<I>(
&self,
input: I,
) -> Result<BinaryHeapMerger<T, C::DeserializationError, impl Fn(&T, &T) -> Ordering + Copy, C>, SortError<C::SerializationError, C::DeserializationError, E>>
pub fn sort<I>( &self, input: I, ) -> Result<BinaryHeapMerger<T, C::DeserializationError, impl Fn(&T, &T) -> Ordering + Copy, C>, SortError<C::SerializationError, C::DeserializationError, E>>
Sorts data from the input. Returns an iterator that can be used to get sorted data stream.
§Arguments
input
- Input stream data to be fetched from
Sourcepub fn sort_by<I, F>(
&self,
input: I,
compare: F,
) -> Result<BinaryHeapMerger<T, C::DeserializationError, F, C>, SortError<C::SerializationError, C::DeserializationError, E>>
pub fn sort_by<I, F>( &self, input: I, compare: F, ) -> Result<BinaryHeapMerger<T, C::DeserializationError, F, C>, SortError<C::SerializationError, C::DeserializationError, E>>
Sorts data from the input using a custom compare function. Returns an iterator that can be used to get sorted data stream.
§Arguments
input
- Input stream data to be fetched fromcompare
- Function be be used to compare items
Auto Trait Implementations§
impl<T, E, B, C> Freeze for ExternalSorter<T, E, B, C>where
B: Freeze,
impl<T, E, B = LimitedBufferBuilder, C = RmpExternalChunk<T>> !RefUnwindSafe for ExternalSorter<T, E, B, C>
impl<T, E, B, C> Send for ExternalSorter<T, E, B, C>
impl<T, E, B, C> Sync for ExternalSorter<T, E, B, C>
impl<T, E, B, C> Unpin for ExternalSorter<T, E, B, C>
impl<T, E, B = LimitedBufferBuilder, C = RmpExternalChunk<T>> !UnwindSafe for ExternalSorter<T, E, B, C>
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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