Repository: atuinsh/atuin (language: rust)

Issue:
Unable to build from Git on Windows
```
...
error[E0277]: the trait bound `tokio::net::TcpStream: hyper::rt::io::Read` is not satisfied
   --> crates\atuin-daemon\src\client.rs:45:37
    |
45  |               .connect_with_connector(service_fn(move |_: Uri| {
    |  ______________----------------------_^
    | |              |
    | |              required by a bound introduced by this call
46  | |                 let url = format!("127.0.0.1:{}", port);
47  | |
48  | |                 TcpStream::connect(url)
49  | |             }))
    | |______________^ the trait `hyper::rt::io::Read` is not implemented for `tokio::net::TcpStream`
    |
    = help: the following other types implement trait `hyper::rt::io::Read`:
              &mut T
              Box<T>
              Pin<P>
              TokioIo<T>
              hyper::upgrade::Upgraded
              hyper_timeout::stream::TimeoutReader<R>
              hyper_timeout::stream::TimeoutStream<S>
              hyper_timeout::stream::TimeoutWriter<W>
note: required by a bound in `Endpoint::connect_with_connector`
   --> C:\Users\ךינשגכהד\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tonic-0.12.1\src\transport\channel\endpoint.rs:351:22
    |
348 |     pub async fn connect_with_connector<C>(&self, connector: C) -> Resu...
    |                  ---------------------- required by a bound in this associated function
...
351 |         C::Response: rt::Read + rt::Write + Send + Unpin + 'static,
    |                      ^^^^^^^^ required by this bound in `Endpoint::connect_with_connector`

error[E0277]: the trait bound `tokio::net::TcpStream: hyper::rt::io::Write` is not satisfied
   --> crates\atuin-daemon\src\client.rs:45:37
    |
45  |               .connect_with_connector(service_fn(move |_: Uri| {
    |  ______________----------------------_^
    | |              |
    | |              required by a bound introduced by this call
46  | |                 let url = format!("127.0.0.1:{}", port);
47  | |
48  | |                 TcpStream::connect(url)
49  | |             }))
    | |______________^ the trait `hyper::rt::io::Write` is not implemented for `tokio::net::TcpStream`
    |
    = help: the following other types implement trait `hyper::rt::io::Write`:
              &mut T
              Box<T>
              Pin<P>
              TokioIo<T>
              hyper::upgrade::Upgraded
              hyper_timeout::stream::TimeoutReader<R>
              hyper_timeout::stream::TimeoutStream<S>
              hyper_timeout::stream::TimeoutWriter<W>
note: required by a bound in `Endpoint::connect_with_connector`
   --> C:\Users\ךינשגכהד\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tonic-0.12.1\src\transport\channel\endpoint.rs:351:33
    |
348 |     pub async fn connect_with_connector<C>(&self, connector: C) -> Resu...
    |                  ---------------------- required by a bound in this associated function
...
351 |         C::Response: rt::Read + rt::Write + Send + Unpin + 'static,
    |                                 ^^^^^^^^^ required by this bound in `Endpoint::connect_with_connector`

error[E0277]: the trait bound `tokio::net::TcpStream: hyper::rt::io::Read` is not satisfied
   --> crates\atuin-daemon\src\client.rs:44:23
    |
44  |           let channel = Endpoint::try_from("http://atuin_local_daemon:0")?
    |  _______________________^
45  | |             .connect_with_connector(service_fn(move |_: Uri| {
46  | |                 let url = format!("127.0.0.1:{}", port);
...   |
49  | |             }))
    | |_______________^ the trait `hyper::rt::io::Read` is not implemented for `tokio::net::TcpStream`
    |
    = help: the following other types implement trait `hyper::rt::io::Read`:
              &mut T
              Box<T>
              Pin<P>
              TokioIo<T>
              hyper::upgrade::Upgraded
              hyper_timeout::stream::TimeoutReader<R>
              hyper_timeout::stream::TimeoutStream<S>
              hyper_timeout::stream::TimeoutWriter<W>
note: required by a bound in `Endpoint::connect_with_connector`
   --> C:\Users\ךינשגכהד\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tonic-0.12.1\src\transport\channel\endpoint.rs:351:22
    |
348 |     pub async fn connect_with_connector<C>(&self, connector: C) -> Resu...
    |                  ---------------------- required by a bound in this associated function
...
351 |         C::Response: rt::Read + rt::Write + Send + Unpin + 'static,
    |                      ^^^^^^^^ required by this bound in `Endpoint::connect_with_connector`

error[E0277]: the trait bound `tokio::net::TcpStream: hyper::rt::io::Write` is not satisfied
   --> crates\atuin-daemon\src\client.rs:44:23
    |
44  |           let channel = Endpoint::try_from("http://atuin_local_daemon:0")?
    |  _______________________^
45  | |             .connect_with_connector(service_fn(move |_: Uri| {
46  | |                 let url = format!("127.0.0.1:{}", port);
...   |
49  | |             }))
    | |_______________^ the trait `hyper::rt::io::Write` is not implemented for `tokio::net::TcpStream`
    |
    = help: the following other types implement trait `hyper::rt::io::Write`:
              &mut T
              Box<T>
              Pin<P>
              TokioIo<T>
              hyper::upgrade::Upgraded
              hyper_timeout::stream::TimeoutReader<R>
              hyper_timeout::stream::TimeoutStream<S>
              hyper_timeout::stream::TimeoutWriter<W>
note: required by a bound in `Endpoint::connect_with_connector`
   --> C:\Users\ךינשגכהד\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tonic-0.12.1\src\transport\channel\endpoint.rs:351:33
    |
348 |     pub async fn connect_with_connector<C>(&self, connector: C) -> Resu...
    |                  ---------------------- required by a bound in this associated function
...
351 |         C::Response: rt::Read + rt::Write + Send + Unpin + 'static,
    |                                 ^^^^^^^^^ required by this bound in `Endpoint::connect_with_connector`

error[E0277]: the trait bound `tokio::net::TcpStream: hyper::rt::io::Read` is not satisfied
   --> crates\atuin-daemon\src\client.rs:50:14
    |
50  |             .await
    |              ^^^^^ the trait `hyper::rt::io::Read` is not implemented for `tokio::net::TcpStream`
    |
    = help: the following other types implement trait `hyper::rt::io::Read`:
              &mut T
              Box<T>
              Pin<P>
              TokioIo<T>
              hyper::upgrade::Upgraded
              hyper_timeout::stream::TimeoutReader<R>
              hyper_timeout::stream::TimeoutStream<S>
              hyper_timeout::stream::TimeoutWriter<W>
note: required by a bound in `Endpoint::connect_with_connector`
   --> C:\Users\ךינשגכהד\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tonic-0.12.1\src\transport\channel\endpoint.rs:351:22
    |
348 |     pub async fn connect_with_connector<C>(&self, connector: C) -> Resu...
    |                  ---------------------- required by a bound in this associated function
...
351 |         C::Response: rt::Read + rt::Write + Send + Unpin + 'static,
    |                      ^^^^^^^^ required by this bound in `Endpoint::connect_with_connector`

error[E0277]: the trait bound `tokio::net::TcpStream: hyper::rt::io::Write` is not satisfied
   --> crates\atuin-daemon\src\client.rs:50:14
    |
50  |             .await
    |              ^^^^^ the trait `hyper::rt::io::Write` is not implemented for `tokio::net::TcpStream`
    |
    = help: the following other types implement trait `hyper::rt::io::Write`:
              &mut T
              Box<T>
              Pin<P>
              TokioIo<T>
              hyper::upgrade::Upgraded
              hyper_timeout::stream::TimeoutReader<R>
              hyper_timeout::stream::TimeoutStream<S>
              hyper_timeout::stream::TimeoutWriter<W>
note: required by a bound in `Endpoint::connect_with_connector`
   --> C:\Users\ךינשגכהד\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tonic-0.12.1\src\transport\channel\endpoint.rs:351:33
    |
348 |     pub async fn connect_with_connector<C>(&self, connector: C) -> Resu...
    |                  ---------------------- required by a bound in this associated function
...
351 |         C::Response: rt::Read + rt::Write + Send + Unpin + 'static,
    |                                 ^^^^^^^^^ required by this bound in `Endpoint::connect_with_connector`

For more information about this error, try `rustc --explain E0277`.
warning: `atuin-daemon` (lib) generated 2 warnings
error: could not compile `atuin-daemon` (lib) due to 6 previous errors; 2 warnings emitted
error: failed to compile `atuin v18.4.0-beta.3 (https://github.com/atuinsh/atuin#0b01d930)`, intermediate artifacts can be found at `C:\Users\0BAC~1\AppData\Local\Temp\cargo-installqH9mA1`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
```


Discussion / hints:
Hello @clin1234, Windows (outside of WSL2) is not supported, nor on the project's roadmap. Applying https://github.com/atuinsh/atuin/pull/2306 should fix this specific issue, but you'd be better off evaluating alternatives with official Windows support.

Fix patch:
diff --git a/crates/atuin-daemon/src/client.rs b/crates/atuin-daemon/src/client.rs
index 3de872d229c..815a71dc301 100644
--- a/crates/atuin-daemon/src/client.rs
+++ b/crates/atuin-daemon/src/client.rs
@@ -45,7 +45,9 @@ impl HistoryClient {
             .connect_with_connector(service_fn(move |_: Uri| {
                 let url = format!("127.0.0.1:{}", port);
 
-                TcpStream::connect(url)
+                async move {
+                    Ok::<_, std::io::Error>(TokioIo::new(TcpStream::connect(url.clone()).await?))
+                }
             }))
             .await
             .map_err(|_| eyre!("failed to connect to local atuin daemon. Is it running?"))?;


Test patch: