TODO: Make `UniformBufferProvider<R>(n..)` generate buffers from `n` to DEFAULT_BUFFER_SIZE. TODO: Make `UniformBufferProvider<R>(..n)` generate buffers from 0 (i.e. no buffering) to `n`. Fortune for throttle's current commit: Half blessing − 半吉master
parent
0a065ed2b6
commit
07c4817a53
@ -1,8 +1,15 @@
|
|||||||
|
use std::io;
|
||||||
|
|
||||||
mod conf;
|
mod conf;
|
||||||
mod prov;
|
mod prov;
|
||||||
mod stream;
|
mod stream;
|
||||||
|
|
||||||
fn main() {
|
fn main() -> io::Result<()> {
|
||||||
println!("Hello, world!");
|
let mut input = io::stdin().lock();
|
||||||
|
let mut output = stream::ThrottleAdaptor::new(prov::UniformThrottleProvider::from(prov::Duration::from_millis(5)..prov::Duration::from_millis(50)), prov::UniformBufferProvider::from(0usize..=10), io::stdout().lock());
|
||||||
|
let copied = io::copy(&mut input, &mut output)?;
|
||||||
|
if cfg!(debug_assertions) {
|
||||||
|
eprintln!("Copied {copied} bytes from input -{output:?}> output");
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue