Skip to content

Commit 0eabd28

Browse files
committed
fixing async-std errors
1 parent e08014a commit 0eabd28

File tree

3 files changed

+47
-39
lines changed

3 files changed

+47
-39
lines changed

Cargo.lock

Lines changed: 34 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/report_aggregator/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::{
1515
/// The [ReportAggregator] is the structure which control the background task spawned to aggregate
1616
/// and send data through Apollo Studio by constructing [Report] ready to be send
1717
pub struct ReportAggregator {
18+
#[allow(dead_code)]
1819
handle: JoinHandle<()>,
1920
sender: Sender<(String, Trace)>,
2021
}
@@ -143,7 +144,14 @@ impl ReportAggregator {
143144

144145
impl Drop for ReportAggregator {
145146
fn drop(&mut self) {
146-
self.handle.abort();
147+
cfg_if::cfg_if! {
148+
if #[cfg(all(feature = "tokio-comp", not(feature = "async-std-comp")))] {
149+
self.handle.abort();
150+
} else if #[cfg(feature = "async-std-comp")] {
151+
} else {
152+
compile_error!("tokio-comp or async-std-comp features required");
153+
}
154+
}
147155
// TODO: Wait for the proper aborted task
148156
}
149157
}

src/runtime.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use futures::Future;
22

3-
#[cfg(feature = "tokio-comp")]
4-
pub use tokio::task::JoinHandle;
5-
63
cfg_if::cfg_if! {
74
if #[cfg(all(feature = "tokio-comp", not(feature = "async-std-comp")))] {
5+
pub use tokio::task::JoinHandle;
86
pub fn spawn(f: impl Future<Output = ()> + Send + 'static) -> JoinHandle<()> {
97
tokio::spawn(f)
108
}
11-
} else if #[cfg(all(feature = "async-std-comp", not(feature = "tokio-comp")))] {
9+
10+
} else if #[cfg(feature = "async-std-comp")] {
11+
pub use async_std::task::JoinHandle;
1212
pub fn spawn(f: impl Future<Output = ()> + Send + 'static) -> JoinHandle<()> {
1313
async_std::task::spawn(f)
1414
}

0 commit comments

Comments
 (0)