Skip to content

Commit 674de1a

Browse files
committed
Added const to make rate switching in the future easier.
1 parent b5cacb3 commit 674de1a

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

TODO.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ Note this will probably migrate to GitHub's native Issues; this was mostly for p
2222

2323
## After making public
2424

25-
- Consider bumping up the refresh rate to 3000?
26-
27-
- Arrow keys for lists. This is a priority!
25+
- Scrolling support for temp/disk
2826

2927
- Travis
3028

@@ -46,18 +44,8 @@ Note this will probably migrate to GitHub's native Issues; this was mostly for p
4644

4745
- Remove any `unwrap()`, ensure no crashing! Might have to use this: <https://doc.rust-lang.org/std/panic/fn.catch_unwind.html>
4846

49-
- Scrolling event in lists
50-
51-
- Switching between panels
52-
5347
- Truncate columns if needed for tables
5448

55-
- Test for Windows support, mac support, other. May be doable, depends on sysinfo and how much I know about other OSes probably.
56-
57-
- Seems like the braille symbols are borked on windows.
58-
59-
- Issue with typing after windows version runs!
60-
6149
- Efficiency!!!
6250

6351
- Filtering in processes (that is, allow searching)
@@ -66,6 +54,4 @@ Note this will probably migrate to GitHub's native Issues; this was mostly for p
6654

6755
- Modularity
6856

69-
- ~~Potentially process managing? Depends on the libraries...~~ Done on Linux!
70-
7157
- Probably good to add a "are you sure" to dd-ing...

src/constants.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
// TODO: Store like three minutes of data, then change how much is shown based on scaling!
22
pub const STALE_MAX_MILLISECONDS : u64 = 60 * 1000; // We wish to store at most 60 seconds worth of data. This may change in the future, or be configurable.
33
pub const TICK_RATE_IN_MILLISECONDS : u64 = 200; // We use this as it's a good value to work with.
4+
pub const DEFAULT_REFRESH_RATE_IN_MILLISECONDS : u128 = 1000;

src/main.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,15 @@ fn main() -> error::Result<()> {
5656
//.after_help("Themes:") // TODO: This and others disabled for now
5757
.get_matches();
5858

59-
let update_rate_in_milliseconds : u128 = matches.value_of("RATE_MILLIS").unwrap_or("1000").parse::<u128>()?;
59+
let update_rate_in_milliseconds : u128 = if matches.is_present("RATE_MILLIS") {
60+
matches
61+
.value_of("RATE_MILLIS")
62+
.unwrap_or(&constants::DEFAULT_REFRESH_RATE_IN_MILLISECONDS.to_string())
63+
.parse::<u128>()?
64+
}
65+
else {
66+
constants::DEFAULT_REFRESH_RATE_IN_MILLISECONDS
67+
};
6068

6169
if update_rate_in_milliseconds < 250 {
6270
return Err(RustopError::InvalidArg {

0 commit comments

Comments
 (0)