From 4a18f3cb3782610633ed45411ed48c9bf870d9ac Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Wed, 15 Jul 2020 13:40:46 +0200 Subject: [PATCH] Fix compilation errors on windows --- Cargo.toml | 3 +++ examples/windows-uds.rs | 6 ++++-- src/lib.rs | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 595538a..350b8c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,3 +65,6 @@ url = "2.1.1" inotify = { version = "0.8.2", default-features = false } nix = "0.17.0" timerfd = "1.1.1" + +[target.'cfg(windows)'.dev-dependencies] +uds_windows = "0.1.4" diff --git a/examples/windows-uds.rs b/examples/windows-uds.rs index 04cfc06..32a6ede 100644 --- a/examples/windows-uds.rs +++ b/examples/windows-uds.rs @@ -10,9 +10,11 @@ fn main() -> std::io::Result<()> { use std::path::PathBuf; + use async_io::Async; + use blocking::block_on; use futures::io; use futures::prelude::*; - use smol::{Async, Task}; + use smol::Task; use tempfile::tempdir; use uds_windows::{UnixListener, UnixStream}; @@ -30,7 +32,7 @@ fn main() -> std::io::Result<()> { let dir = tempdir()?; let path = dir.path().join("socket"); - smol::run(async { + block_on(async { // Create a listener. let listener = Async::new(UnixListener::bind(&path)?)?; println!("Listening on {:?}", listener.get_ref().local_addr()?); diff --git a/src/lib.rs b/src/lib.rs index cd2a169..11f6511 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -255,7 +255,6 @@ fn enter(f: impl FnOnce() -> T) -> T { #[cfg(feature = "tokio02")] { - use once_cell::sync::Lazy; use std::cell::Cell; use tokio::runtime::Runtime;