| 1 | #[cfg(not(windows))] |
| 2 | extern crate termiosrust-analyzer cargo getch 0.3.1 termios/; |
| 3 | #[cfg(not(windows))] |
| 4 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#; |
| 5 | #[cfg(windows)] |
| 6 | pub struct Getch{} |
| 7 | |
| 8 | #[cfg(not(windows))] |
| 9 | pub enum Getchrust-analyzer cargo getch 0.3.1 Getch# { |
| 10 | Termiosrust-analyzer cargo getch 0.3.1 Getch#Termios#(termiosrust-analyzer cargo termios 0.3.3 crate/::Termiosrust-analyzer cargo termios 0.3.3 Termios#), |
| 11 | Nonerust-analyzer cargo getch 0.3.1 Getch#None# |
| 12 | } |
| 13 | |
| 14 | #[cfg(windows)] |
| 15 | extern crate libc; |
| 16 | #[cfg(windows)] |
| 17 | use libc::c_int; |
| 18 | #[cfg(windows)] |
| 19 | extern "C" { |
| 20 | fn _getch()->c_int; |
| 21 | } |
| 22 | |
| 23 | #[cfg(not(windows))] |
| 24 | use termiosrust-analyzer cargo termios 0.3.3 crate/::{tcsetattrrust-analyzer cargo termios 0.3.3 tcsetattr().,ICANONrust-analyzer cargo termios 0.3.3 os/linux/ICANON.,ECHOrust-analyzer cargo termios 0.3.3 os/linux/ECHO.}; |
| 25 | |
| 26 | impl Getchrust-analyzer cargo getch 0.3.1 Getch# { |
| 27 | #[cfg(windows)] |
| 28 | pub fn new() -> Getchrust-analyzer cargo getch 0.3.1 Getch# { |
| 29 | Getchrust-analyzer cargo getch 0.3.1 Getch#{} |
| 30 | } |
| 31 | #[cfg(not(windows))] |
| 32 | pub fn newrust-analyzer cargo getch 0.3.1 impl#[Getch]new().() -> Getchrust-analyzer cargo getch 0.3.1 Getch# { |
| 33 | if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(mut termios) = termiosrust-analyzer cargo termios 0.3.3 crate/::Termiosrust-analyzer cargo termios 0.3.3 Termios#::from_fdrust-analyzer cargo termios 0.3.3 impl#[Termios]from_fd().(0) { |
| 34 | let c_lflag = termios.c_lflagrust-analyzer cargo termios 0.3.3 os/linux/termios#c_lflag.; |
| 35 | termios.c_lflagrust-analyzer cargo termios 0.3.3 os/linux/termios#c_lflag. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAndAssign<Self>`]bitand_assign().&=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAndAssign<Self>`]bitand_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAndAssign<Self>`]bitand_assign().!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][Not]not().(ICANONrust-analyzer cargo termios 0.3.3 os/linux/ICANON.|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().ECHOrust-analyzer cargo termios 0.3.3 os/linux/ECHO.); |
| 36 | |
| 37 | if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) = tcsetattrrust-analyzer cargo termios 0.3.3 tcsetattr().(0, termiosrust-analyzer cargo termios 0.3.3 crate/::TCSADRAINrust-analyzer cargo termios 0.3.3 os/linux/TCSADRAIN., &termios) { |
| 38 | termios.c_lflagrust-analyzer cargo termios 0.3.3 os/linux/termios#c_lflag. = c_lflag; |
| 39 | return Getchrust-analyzer cargo getch 0.3.1 Getch#::Termiosrust-analyzer cargo getch 0.3.1 Getch#Termios#(termios) |
| 40 | } |
| 41 | } |
| 42 | Getchrust-analyzer cargo getch 0.3.1 Getch#::Nonerust-analyzer cargo getch 0.3.1 Getch#None# |
| 43 | } |
| 44 | |
| 45 | #[cfg(windows)] |
| 46 | pub fn getch(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<u8, stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 47 | loop { |
| 48 | unsafe { |
| 49 | let k= _getch(); |
| 50 | if k==0 { |
| 51 | // Ignore next input. |
| 52 | _getch(); |
| 53 | } else { |
| 54 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(k as u8) |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | #[cfg(not(windows))] |
| 60 | pub fn getchrust-analyzer cargo getch 0.3.1 impl#[Getch]getch().(&self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<u8, stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 61 | let mut r:[u8;1]=[0]; |
| 62 | let mut stdin = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::stdinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/stdin().(); |
| 63 | loop { |
| 64 | if stdin.readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/impl#[Stdin][Read]read().(&mut r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0) } |
| 65 | else { |
| 66 | if r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().27 { |
| 67 | if stdin.readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/impl#[Stdin][Read]read().(&mut r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0) } |
| 68 | if r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'[' || (r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge().b'0' && r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().b'9') { |
| 69 | if stdin.readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/impl#[Stdin][Read]read().(&mut r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0) } |
| 70 | // Skip all until we see a letter. |
| 71 | while !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().((r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge().b'a' && r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().b'z') || (r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge().b'A' && r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().b'Z')) { |
| 72 | if stdin.readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/impl#[Stdin][Read]read().(&mut r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0) } |
| 73 | } |
| 74 | if stdin.readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/impl#[Stdin][Read]read().(&mut r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0) } |
| 75 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().) |
| 76 | } else if r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'(' || r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b')' || r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'#' { |
| 77 | // skip the next character and return |
| 78 | if stdin.readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/impl#[Stdin][Read]read().(&mut r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0) } |
| 79 | if stdin.readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/impl#[Stdin][Read]read().(&mut r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0) } |
| 80 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().) |
| 81 | } else { |
| 82 | // return the next character |
| 83 | if stdin.readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/impl#[Stdin][Read]read().(&mut r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0) } |
| 84 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().) |
| 85 | } |
| 86 | } else { |
| 87 | // TODO: accept utf-8 |
| 88 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(r[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().) |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | impl Droprust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/drop/Drop# for Getchrust-analyzer cargo getch 0.3.1 Getch# { |
| 96 | #[cfg(not(windows))] |
| 97 | fn droprust-analyzer cargo getch 0.3.1 impl#[Getch][Drop]drop().(&mut self) { |
| 98 | if let Getchrust-analyzer cargo getch 0.3.1 Getch#::Termiosrust-analyzer cargo getch 0.3.1 Getch#Termios#(ref mut termios) = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self { |
| 99 | tcsetattrrust-analyzer cargo termios 0.3.3 tcsetattr().(0, termiosrust-analyzer cargo termios 0.3.3 crate/::TCSADRAINrust-analyzer cargo termios 0.3.3 os/linux/TCSADRAIN., &termios).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(()) |
| 100 | } |
| 101 | } |
| 102 | #[cfg(windows)] |
| 103 | fn drop(&mut self) { |
| 104 | } |
| 105 | } |