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

Commit

Permalink
use pin_project instead of pin_project_lite
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelchcki committed Apr 12, 2022
1 parent b37b093 commit 55a6079
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 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
27 changes: 17 additions & 10 deletions ddprof-exporter/src/connector/conn_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,23 @@ use futures::{future, Future, FutureExt, TryFutureExt};
use hyper_rustls::HttpsConnector;
use pin_project::pin_project;

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>},
// Tokio doesn't handle unix sockets on windows
#[cfg(unix)]
Udp{ #[pin] transport: tokio::net::UnixStream },
}
#[derive(Debug)]
#[pin_project(project=ConnStreamProj)]
pub enum ConnStream {
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,
},
}

pub type ConnStreamError = Box<dyn std::error::Error + Send + Sync>;
Expand Down

0 comments on commit 55a6079

Please sign in to comment.