summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-04-25 14:44:12 +0200
committermo8it <mo8it@proton.me>2024-04-25 14:44:12 +0200
commit14fe248b4bfc3c577be7deacc346a959c7c0cc47 (patch)
tree2098c724c8538e080f1ac2132bf3c242c9643619 /src/main.rs
parent88f27a53771a49a4e541627b84cc5dc7ab6f7357 (diff)
Optimize the notify event handler
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index a928504..7a142fd 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -144,23 +144,23 @@ fn main() -> Result<()> {
match args.command {
None => {
- let notify_exercise_paths: Option<&'static [&'static str]> = if args.manual_run {
+ let notify_exercise_names = if args.manual_run {
None
} else {
// For the the notify event handler thread.
// Leaking is not a problem because the slice lives until the end of the program.
Some(
- app_state
+ &*app_state
.exercises()
.iter()
- .map(|exercise| exercise.path)
+ .map(|exercise| exercise.name.as_bytes())
.collect::<Vec<_>>()
.leak(),
)
};
loop {
- match watch::watch(&mut app_state, notify_exercise_paths)? {
+ match watch::watch(&mut app_state, notify_exercise_names)? {
WatchExit::Shutdown => break,
// It is much easier to exit the watch mode, launch the list mode and then restart
// the watch mode instead of trying to pause the watch threads and correct the