Skip to content

Commit

Permalink
refactor(term): use std::ops::ControlFlow for app loop control
Browse files Browse the repository at this point in the history
  • Loading branch information
ymgyt committed May 21, 2024
1 parent 13c7b8d commit 9942398
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/synd_term/src/application/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{
future,
ops::{Add, Sub},
ops::{Add, ControlFlow, Sub},
pin::Pin,
time::Duration,
};
Expand Down Expand Up @@ -222,13 +222,13 @@ impl Application {
self.render();

loop {
if self.event_loop_until_idle(input).await == EventLoopControlFlow::Quit {
if self.event_loop_until_idle(input).await.is_break() {
break;
}
}
}

pub async fn event_loop_until_idle<S>(&mut self, input: &mut S) -> EventLoopControlFlow
pub async fn event_loop_until_idle<S>(&mut self, input: &mut S) -> ControlFlow<()>
where
S: Stream<Item = std::io::Result<CrosstermEvent>> + Unpin,
{
Expand Down Expand Up @@ -262,7 +262,7 @@ impl Application {

if self.flags.contains(Should::Quit) {
self.flags.remove(Should::Quit); // for testing
break EventLoopControlFlow::Quit;
break ControlFlow::Break(());
}
}
}
Expand Down

0 comments on commit 9942398

Please sign in to comment.