Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
Make pin_project_lite usage compile on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelchcki committed Apr 12, 2022
1 parent b37b093 commit 6924d1c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/actions/cache/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: '[rust] Checkout and cache'
description: '[rust] Checkout cache'
name: '[rust] Cache'
description: '[rust] Cache'

runs:
using: composite
Expand Down
22 changes: 1 addition & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ddprof-exporter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ futures-core = { version = "0.3.0", default-features = false }
futures-util = { version = "0.3.0", default-features = false }
mime_guess = { version = "2.0", default-features = false }
http-body = "0.4"
pin-project = "1.0"
pin-project-lite = "0.2.8"
rustls = { version = "0.20.4", default-features = false }
rustls-native-certs = { version = "0.6" }
hyper-rustls = { version = "0.23", default-features = false, features = ["native-tokio", "http1", "tls12"] }
Expand Down
30 changes: 25 additions & 5 deletions ddprof-exporter/src/connector/conn_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,37 @@ use std::{

use futures::{future, Future, FutureExt, TryFutureExt};
use hyper_rustls::HttpsConnector;
use pin_project::pin_project;
use pin_project_lite::pin_project;

#[cfg(unix)]
pin_project! {
#[derive(Debug)]
#[project = ConnStreamProj]
pub enum ConnStream {
Tcp{ #[pin] transport: tokio::net::TcpStream },
Tls{ #[pin] transport: tokio_rustls::client::TlsStream<tokio::net::TcpStream>},
Tcp {
#[pin] transport: tokio::net::TcpStream,
},
Tls {
#[pin] transport: tokio_rustls::client::TlsStream<tokio::net::TcpStream>,
},
// Tokio doesn't handle unix sockets on windows
#[cfg(unix)]
Udp{ #[pin] transport: tokio::net::UnixStream },
Udp {
#[pin] transport: tokio::net::UnixStream,
},
}
}

#[cfg(not(unix))]
pin_project! {
#[derive(Debug)]
#[project = ConnStreamProj]
pub enum ConnStream {
Tcp {
#[pin] transport: tokio::net::TcpStream,
},
Tls {
#[pin] transport: tokio_rustls::client::TlsStream<tokio::net::TcpStream>,
},
}
}

Expand Down

0 comments on commit 6924d1c

Please sign in to comment.