pub enum MemoryUsage {
MemorySize(usize),
BatchSize(usize),
}Expand description
An enum expressing the memory requirements for batched algorithms
such as SortPairs, ParSortPairs, and ParSortIters.
This type implements Mul and Div to
scale the memory usage requirements by a given factor, independently of the
variant.
Variants§
MemorySize(usize)
The target overall memory usage in bytes.
This is the more user-friendly option. The actual number of elements
can be computed using batch_size.
BatchSize(usize)
The number of elements used in all batches.
This is a more low-level option that gives more control to the user, but the actual memory usage will depend on the size of labels (if any).
Implementations§
Source§impl MemoryUsage
impl MemoryUsage
Sourcepub fn from_perc(perc: f64) -> Self
pub fn from_perc(perc: f64) -> Self
Creates a new memory usage expressed as a percentage of the physical RAM.
Sourcepub fn batch_size<T>(&self) -> usize
pub fn batch_size<T>(&self) -> usize
Returns the batch size for elements of type T.
If the memory usage is expressed as a number of
bytes, this method divides the number of bytes
by the size of T to obtain the number of elements. Otherwise, it just
returns specified batch size.
Trait Implementations§
Source§impl Clone for MemoryUsage
impl Clone for MemoryUsage
Source§fn clone(&self) -> MemoryUsage
fn clone(&self) -> MemoryUsage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MemoryUsage
impl Debug for MemoryUsage
Source§impl Default for MemoryUsage
Default implementation, returning half of the physical RAM.
impl Default for MemoryUsage
Default implementation, returning half of the physical RAM.
Source§impl Display for MemoryUsage
impl Display for MemoryUsage
Source§impl Div<usize> for MemoryUsage
impl Div<usize> for MemoryUsage
Source§impl Mul<usize> for MemoryUsage
impl Mul<usize> for MemoryUsage
impl Copy for MemoryUsage
Auto Trait Implementations§
impl Freeze for MemoryUsage
impl RefUnwindSafe for MemoryUsage
impl Send for MemoryUsage
impl Sync for MemoryUsage
impl Unpin for MemoryUsage
impl UnsafeUnpin for MemoryUsage
impl UnwindSafe for MemoryUsage
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, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<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