pub struct BatchGenerator { /* private fields */ }Expand description
High-performance batch key generator.
BatchGenerator provides a fluent API for generating large batches
of private keys with configurable parallelism and memory efficiency.
§Example
use rustywallet_batch::prelude::*;
// Generate 1000 keys
let keys = BatchGenerator::new()
.count(1000)
.generate_vec()
.unwrap();
// Generate with parallel processing
let keys = BatchGenerator::new()
.count(100_000)
.parallel()
.generate_vec()
.unwrap();
// Stream keys for memory efficiency
let stream = BatchGenerator::new()
.count(1_000_000)
.generate()
.unwrap();
for key in stream.take(100) {
println!("{}", key.unwrap().to_hex());
}Implementations§
Source§impl BatchGenerator
impl BatchGenerator
Sourcepub fn with_config(config: BatchConfig) -> Self
pub fn with_config(config: BatchConfig) -> Self
Create a batch generator with a specific configuration.
Sourcepub fn chunk_size(self, size: usize) -> Self
pub fn chunk_size(self, size: usize) -> Self
Set the chunk size for streaming operations.
Sourcepub fn deterministic(self) -> Self
pub fn deterministic(self) -> Self
Enable deterministic ordering in parallel mode.
Sourcepub fn generate(self) -> Result<KeyStream, BatchError>
pub fn generate(self) -> Result<KeyStream, BatchError>
Generate keys as a memory-efficient stream.
This method returns a KeyStream that generates keys on-demand,
allowing processing of millions of keys without memory exhaustion.
Sourcepub fn generate_vec(self) -> Result<Vec<PrivateKey>, BatchError>
pub fn generate_vec(self) -> Result<Vec<PrivateKey>, BatchError>
Generate keys and collect them into a vector.
This method generates all keys and stores them in memory.
For large batches, consider using generate() for streaming.
Trait Implementations§
Source§impl Clone for BatchGenerator
impl Clone for BatchGenerator
Source§fn clone(&self) -> BatchGenerator
fn clone(&self) -> BatchGenerator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BatchGenerator
impl Debug for BatchGenerator
Auto Trait Implementations§
impl Freeze for BatchGenerator
impl RefUnwindSafe for BatchGenerator
impl Send for BatchGenerator
impl Sync for BatchGenerator
impl Unpin for BatchGenerator
impl UnwindSafe for BatchGenerator
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> 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>
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