disktest_lib/
generator.rs1mod chacha;
13mod crc;
14
15use crate::util::prettybytes;
16use anyhow as ah;
17
18pub use crate::generator::chacha::GeneratorChaCha12;
19pub use crate::generator::chacha::GeneratorChaCha20;
20pub use crate::generator::chacha::GeneratorChaCha8;
21pub use crate::generator::crc::GeneratorCrc;
22
23pub trait NextRandom {
24 fn get_base_size(&self) -> usize;
26
27 fn next(&mut self, buf: &mut [u8], count: usize);
32
33 fn seek(&mut self, byte_offset: u64) -> ah::Result<()> {
35 if byte_offset == 0 {
36 Ok(())
37 } else {
38 Err(ah::format_err!(
39 "The selected random number generator \
40 does not support seeking to byte offset {}.",
41 prettybytes(byte_offset, true, true, true)
42 ))
43 }
44 }
45}
46
47