1
0
mirror of https://github.com/Miserlou/Loop synced 2024-07-08 19:45:57 +00:00

formatting

This commit is contained in:
Rich Jones 2018-05-17 17:31:15 -04:00
parent 26006750d4
commit ac6db9485b
2 changed files with 30 additions and 27 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/target
**/*.rs.bk

View File

@ -14,7 +14,7 @@ use subprocess::{Exec, ExitStatus};
fn main() {
// Load the CLI
// Load the CLI
let yaml = load_yaml!("cli.yml");
let matches = App::from_yaml(yaml).get_matches();
@ -25,7 +25,7 @@ fn main() {
// Number of iterations
let mut num = matches.value_of("num").unwrap_or("-1").parse::<f64>().unwrap();
if num < 0.0{
num = f64::INFINITY;
num = f64::INFINITY;
}
// Number of iterations
@ -47,35 +47,35 @@ fn main() {
let mut executor;
let mut buf_reader;
while count < num {
while count < num {
// Time Start
start = Instant::now();
// Time Start
start = Instant::now();
// Main executor
executor = Exec::shell(&input_s).stream_stdout().unwrap();
buf_reader = BufReader::new(executor);
// Main executor
executor = Exec::shell(&input_s).stream_stdout().unwrap();
buf_reader = BufReader::new(executor);
// Print the results
for (_i, line) in buf_reader.lines().enumerate() {
println!("{}", line.unwrap());
}
// Print the results
for (_i, line) in buf_reader.lines().enumerate() {
println!("{}", line.unwrap());
}
// Increment counters
count = count + 1.0;
adjusted_count = adjusted_count + count_by;
// Increment counters
count = count + 1.0;
adjusted_count = adjusted_count + count_by;
env::set_var("COUNT", adjusted_count.to_string());
env::set_var("ACTUALCOUNT", (count as i64).to_string());
env::set_var("COUNT", adjusted_count.to_string());
env::set_var("ACTUALCOUNT", (count as i64).to_string());
// Delay until next iteration time
loop {
now = Instant::now();
since = now.duration_since(start);
match every.checked_sub(since) {
None => break,
Some(time) => continue,
}
}
}
// Delay until next iteration time
loop {
now = Instant::now();
since = now.duration_since(start);
match every.checked_sub(since) {
None => break,
Some(time) => continue,
}
}
}
}