clarify Blocking enum; Blocking::No -> DoNotWait

This commit is contained in:
Wez Furlong committed 2018-07-24 06:25:58 -07:00
1 parent a781d8eb5a
commit d1ea0588a3
4 files changed
+7 -7

No files matched your search

+1 -1
View File
@@ -38,7 +38,7 @@ fn main() -> Result<(), Error> {
buf.terminal().set_raw_mode()?;
loop {
match buf.terminal().poll_input(Blocking::Yes) {
match buf.terminal().poll_input(Blocking::Wait) {
Ok(Some(input)) => match input {
InputEvent::Key(KeyEvent {
key: KeyCode::Escape,
+2 -2
View File
@@ -41,8 +41,8 @@ pub struct ScreenSize {
#[derive(Debug, Clone, Copy)]
pub enum Blocking {
No,
Yes,
DoNotWait,
Wait,
}
/// `Terminal` abstracts over some basic terminal capabilities.
+2 -2
View File
@@ -94,8 +94,8 @@ impl TtyReadHandle {
fn set_blocking(&mut self, blocking: Blocking) -> Result<(), Error> {
let value: libc::c_int = match blocking {
Blocking::Yes => 0,
Blocking::No => 1,
Blocking::Wait => 0,
Blocking::DoNotWait => 1,
};
if unsafe { libc::ioctl(*self.fd, libc::FIONBIO, &value as *const _) } != 0 {
bail!("failed to ioctl(FIONBIO): {:?}", IoError::last_os_error());
+2 -2
View File
@@ -449,8 +449,8 @@ impl Terminal for WindowsTerminal {
}
let pending = match (self.input_handle.get_number_of_input_events()?, blocking) {
(0, Blocking::No) => return Ok(None),
(0, Blocking::Yes) => 1,
(0, Blocking::DoNotWait) => return Ok(None),
(0, Blocking::Wait) => 1,
(pending, _) => pending,
};