Repository: crossterm-rs/crossterm (language: rust)

Issue:
Cannot build crossterm 28.1 with use-dev-tty + event-stream features
When enabling both use-dev-tty feature and event-stream feature, latest crossterm 28.1 fails to build. This is a complete example of how to reproduce the build error:
```
~ ❯ cargo init crosstermtest && cd crosstermtest
    Creating binary (application) package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
~/crosstermtest master* ❯ cargo add crossterm --features use-dev-tty,event-stream
    Updating crates.io index
      Adding crossterm v0.28.1 to dependencies
             Features:
             + bracketed-paste
             + event-stream
             + events
             + filedescriptor
             + use-dev-tty
             + windows
             - libc
             - serde
    Updating crates.io index
     Locking 44 packages to latest compatible versions
      Adding hermit-abi v0.3.9 (latest: v0.4.0)
      Adding linux-raw-sys v0.4.14 (latest: v0.6.5)
      Adding wasi v0.11.0+wasi-snapshot-preview1 (latest: v0.13.3+wasi-0.2.2)
      Adding windows-sys v0.52.0 (latest: v0.59.0)
~/crosstermtest master* ❯ cat Cargo.toml | grep crossterm
name = "crosstermtest"
crossterm = { version = "0.28.1", features = ["use-dev-tty", "event-stream"] }
~/crosstermtest master* ❯ cargo build
   Compiling libc v0.2.159
   Compiling proc-macro2 v1.0.87
   ... (cut)
   Compiling filedescriptor v0.8.2
   Compiling crossterm v0.28.1
error[E0599]: no variant or associated item named `new` found for enum `FileDesc` in the current scope
   --> /home/da/.cargo/registry/src/index.crates.io-6f17d22bba15001f/crossterm-0.28.1/src/event/source/unix/tty.rs:188:36
    |
188 |                 let fd = FileDesc::new(self.wake_pipe.receiver.as_raw_fd(), false);
    |                                    ^^^ variant or associated item not found in `FileDesc<'_>`
    |
   ::: /home/da/.cargo/registry/src/index.crates.io-6f17d22bba15001f/crossterm-0.28.1/src/terminal/sys/file_descriptor.rs:30:1
    |
30  | pub enum FileDesc<'a> {
    | --------------------- variant or associated item `new` not found for this enum
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `new`, perhaps you need to implement it:
            candidate #1: `parking_lot_core::thread_parker::ThreadParkerT`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `crossterm` (lib) due to 1 previous error
```


Discussion / hints:
@apanloco adding `libc` feature fixes the problem. While mirgating to rastix, `new` method was not impemented here
```Rust
#[cfg(not(feature = "libc"))]
impl FileDesc<'_> {
    pub fn read(&self, buffer: &mut [u8]) -> io::Result<usize> {
        let fd = match self {
            FileDesc::Owned(fd) => fd.as_fd(),
            FileDesc::Borrowed(fd) => fd.as_fd(),
        };
        let result = rustix::io::read(fd, buffer)?;
        Ok(result)
    }

    pub fn raw_fd(&self) -> RawFd {
        match self {
            FileDesc::Owned(fd) => fd.as_raw_fd(),
            FileDesc::Borrowed(fd) => fd.as_raw_fd(),
        }
    }
}
```

Fix patch:
diff --git a/src/event/source/unix/tty.rs b/src/event/source/unix/tty.rs
index 03d76b401..9401a54e7 100644
--- a/src/event/source/unix/tty.rs
+++ b/src/event/source/unix/tty.rs
@@ -185,7 +185,10 @@ impl EventSource for UnixInternalEventSource {
 
             #[cfg(feature = "event-stream")]
             if fds[2].revents & POLLIN != 0 {
+                #[cfg(feature = "libc")]
                 let fd = FileDesc::new(self.wake_pipe.receiver.as_raw_fd(), false);
+                #[cfg(not(feature = "libc"))]
+                let fd = FileDesc::Borrowed(self.wake_pipe.receiver.as_fd());
                 // drain the pipe
                 while read_complete(&fd, &mut [0; 1024])? != 0 {}
 


Test patch:
diff --git a/.github/workflows/crossterm_test.yml b/.github/workflows/crossterm_test.yml
index 9088af510..bde4d37b1 100644
--- a/.github/workflows/crossterm_test.yml
+++ b/.github/workflows/crossterm_test.yml
@@ -68,7 +68,7 @@ jobs:
       continue-on-error: ${{ matrix.can-fail }}
     - name: Test no default features with use-dev-tty feature enabled
       if: matrix.os != 'windows-2019'
-      run: cargo test --no-default-features --features "use-dev-tty events bracketed-paste" -- --nocapture --test-threads 1
+      run: cargo test --no-default-features --features "use-dev-tty events event-stream bracketed-paste" -- --nocapture --test-threads 1
       continue-on-error: ${{ matrix.can-fail }}
     - name: Test no default features with windows feature enabled
       if: matrix.os == 'windows-2019'