pub struct BatchConfig {
pub batch_size: usize,
pub thread_count: Option<usize>,
pub use_simd: bool,
pub chunk_size: usize,
pub memory_limit: Option<usize>,
pub parallel: bool,
pub deterministic_order: bool,
}Expand description
Configuration for batch key generation.
Use the builder pattern or preset configurations for common use cases.
§Example
use rustywallet_batch::config::BatchConfig;
// Custom configuration
let config = BatchConfig::default()
.with_batch_size(100_000)
.with_thread_count(Some(4))
.with_chunk_size(1000);
// Or use presets
let fast = BatchConfig::fast();
let balanced = BatchConfig::balanced();
let memory_efficient = BatchConfig::memory_efficient();Fields§
§batch_size: usizeNumber of keys to generate in a batch.
thread_count: Option<usize>Number of threads to use for parallel processing. None means auto-detect based on available CPU cores.
use_simd: boolWhether to use SIMD optimization when available.
chunk_size: usizeSize of chunks for streaming operations.
memory_limit: Option<usize>Maximum memory limit in bytes (optional).
parallel: boolWhether to use parallel processing.
deterministic_order: boolWhether to maintain deterministic ordering in parallel mode.
Implementations§
Source§impl BatchConfig
impl BatchConfig
Sourcepub fn fast() -> Self
pub fn fast() -> Self
Preset configuration optimized for maximum speed.
Uses parallel processing with all available cores and larger chunk sizes.
Sourcepub fn balanced() -> Self
pub fn balanced() -> Self
Preset configuration balancing speed and memory usage.
Uses parallel processing with moderate chunk sizes.
Sourcepub fn memory_efficient() -> Self
pub fn memory_efficient() -> Self
Preset configuration optimized for minimal memory usage.
Uses smaller chunk sizes and streaming to minimize memory footprint.
Sourcepub fn with_batch_size(self, size: usize) -> Self
pub fn with_batch_size(self, size: usize) -> Self
Set the batch size.
Sourcepub fn with_thread_count(self, count: Option<usize>) -> Self
pub fn with_thread_count(self, count: Option<usize>) -> Self
Set the thread count for parallel processing.
Sourcepub fn with_chunk_size(self, size: usize) -> Self
pub fn with_chunk_size(self, size: usize) -> Self
Set the chunk size for streaming operations.
Sourcepub fn with_memory_limit(self, limit: Option<usize>) -> Self
pub fn with_memory_limit(self, limit: Option<usize>) -> Self
Set the memory limit in bytes.
Sourcepub fn with_parallel(self, enabled: bool) -> Self
pub fn with_parallel(self, enabled: bool) -> Self
Enable or disable parallel processing.
Sourcepub fn with_deterministic_order(self, enabled: bool) -> Self
pub fn with_deterministic_order(self, enabled: bool) -> Self
Enable or disable deterministic ordering in parallel mode.
Sourcepub fn validate(&self) -> Result<(), BatchError>
pub fn validate(&self) -> Result<(), BatchError>
Validate the configuration.
Returns an error if any configuration parameter is invalid.
Sourcepub fn effective_thread_count(&self) -> usize
pub fn effective_thread_count(&self) -> usize
Get the effective thread count.
Returns the configured thread count or the number of available CPU cores.
Trait Implementations§
Source§impl Clone for BatchConfig
impl Clone for BatchConfig
Source§fn clone(&self) -> BatchConfig
fn clone(&self) -> BatchConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BatchConfig
impl Debug for BatchConfig
Auto Trait Implementations§
impl Freeze for BatchConfig
impl RefUnwindSafe for BatchConfig
impl Send for BatchConfig
impl Sync for BatchConfig
impl Unpin for BatchConfig
impl UnwindSafe for BatchConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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