Skip to content

Commit

Permalink
Add named pipes implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
blackbeam authored and AIkorsky committed Feb 27, 2021
1 parent e42317b commit b272977
Show file tree
Hide file tree
Showing 6 changed files with 644 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tokio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ net = [
"mio/tcp",
"mio/udp",
"mio/uds",
"winapi/winbase",
]
process = [
"bytes",
Expand Down Expand Up @@ -94,7 +95,7 @@ pin-project-lite = "0.2.0"
bytes = { version = "1.0.0", optional = true }
once_cell = { version = "1.5.2", optional = true }
memchr = { version = "2.2", optional = true }
mio = { version = "0.7.6", optional = true }
mio = { version = "0.7.9", optional = true }
num_cpus = { version = "1.8.0", optional = true }
parking_lot = { version = "0.11.0", optional = true }

Expand All @@ -111,6 +112,9 @@ signal-hook-registry = { version = "1.1.1", optional = true }
libc = { version = "0.2.42" }
nix = { version = "0.19.0" }

[target.'cfg(windows)'.dependencies.miow]
version = "0.3.6"

[target.'cfg(windows)'.dependencies.winapi]
version = "0.3.8"
default-features = false
Expand All @@ -124,6 +128,9 @@ proptest = "0.10.0"
tempfile = "3.1.0"
async-stream = "0.3"

[target.'cfg(windows)'.dev-dependencies.ntapi]
version = "0.3.6"

[target.'cfg(loom)'.dev-dependencies]
loom = { version = "0.4", features = ["futures", "checkpoint"] }

Expand Down
10 changes: 10 additions & 0 deletions tokio/src/macros/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@ macro_rules! cfg_net_unix {
}
}

macro_rules! cfg_net_windows {
($($item:item)*) => {
$(
#[cfg(all(target_os = "windows", feature = "net"))]
#[cfg_attr(docsrs, doc(cfg(all(target_os = "windows", feature = "net"))))]
$item
)*
}
}

macro_rules! cfg_process {
($($item:item)*) => {
$(
Expand Down
5 changes: 5 additions & 0 deletions tokio/src/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,8 @@ cfg_net_unix! {
pub use unix::listener::UnixListener;
pub use unix::stream::UnixStream;
}

cfg_net_windows! {
pub mod windows;
pub use windows::named_pipe::{NamedPipe, NamedPipeServer, NamedPipeServerBuilder};
}
3 changes: 3 additions & 0 deletions tokio/src/net/windows/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! Windows platform functionality.

pub mod named_pipe;

0 comments on commit b272977

Please sign in to comment.