better progress display
This commit is contained in:
parent
9e8ec4db3c
commit
629228d365
3 changed files with 11 additions and 5 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -4,4 +4,4 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "qft"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "qft"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -1,7 +1,7 @@
|
|||
use std::{
|
||||
collections::HashMap,
|
||||
fs::File,
|
||||
io::{Error, Read, Write},
|
||||
io::{Error, Read, Write, stdout},
|
||||
net::*,
|
||||
str::FromStr,
|
||||
thread,
|
||||
|
@ -256,7 +256,10 @@ fn sender(args: &Vec<String>) {
|
|||
|
||||
sc.write_safe(&buf[..read]).expect("send error");
|
||||
bytes_sent += read as u64;
|
||||
print!("\rSent {} bytes", bytes_sent);
|
||||
if (bytes_sent % (br * 20) as u64) < (br as u64) {
|
||||
print!("\rSent {} bytes", bytes_sent);
|
||||
stdout().flush().unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -285,7 +288,10 @@ fn receiver(args: &Vec<String>) {
|
|||
|
||||
file.write(buf).expect("write error");
|
||||
bytes_received += len as u64;
|
||||
print!("\rReceived {} bytes", bytes_received);
|
||||
if (bytes_received % (br * 20) as u64) < (br as u64) {
|
||||
print!("\rReceived {} bytes", bytes_received);
|
||||
stdout().flush().unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue