Expand description
Asynchronous anonymous pipe for Windows.
Note that we specifically do not use
CreatePipe
here because unfortunately the anonymous pipes returned do not support overlapped operations. Instead, we create a “hopefully unique” name and create a named pipe which has overlapped operations enabled.
§Supported platform
x86_64-pc-windows-msvc
only
§Example
use tokio::io::{AsyncReadExt, AsyncWriteExt};
#[tokio::main(flavor = "current_thread")]
async fn main() -> anyhow::Result<()> {
let (mut r, mut w) = tokio_anon_pipe::anon_pipe().await?;
w.write_all(b"HELLO, WORLD!").await?;
let mut buf = [0; 16];
let len = r.read(&mut buf[..]).await?;
assert_eq!(&buf[..len], &b"HELLO, WORLD!"[..]);
Ok(())
}
Structs§
- Connect
- Represents connectability.
Enums§
- Anon
Pipe Read - Asyncronous Pipe Read.
- Anon
Pipe Write - Asyncronous Pipe Write.
Functions§
- anon_
pipe - Open Anonynous Pipe Pair. Pair is connected.
- anon_
pipe_ we_ read - Open Anonynous Pipe Pair. Pair is not connected yet.
- anon_
pipe_ we_ write - Open Anonynous Pipe Pair Pair is not connected yet.