We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bac74c2 commit 2ca9c46Copy full SHA for 2ca9c46
tests/uds.rs
@@ -22,3 +22,21 @@ fn send_recv() -> io::Result<()> {
22
Ok(())
23
})
24
}
25
+
26
+#[test]
27
+fn into_raw_fd() -> io::Result<()> {
28
+ use async_std::os::unix::io::{FromRawFd, IntoRawFd};
29
+ task::block_on(async {
30
+ let (socket1, socket2) = UnixDatagram::pair().unwrap();
31
+ socket1.send(JULIUS_CAESAR).await?;
32
33
+ let mut buf = vec![0; 1024];
34
35
+ let socket2 = unsafe { UnixDatagram::from_raw_fd(socket2.into_raw_fd()) };
36
+ let n = socket2.recv(&mut buf).await?;
37
+ assert_eq!(&buf[..n], JULIUS_CAESAR);
38
39
+ Ok(())
40
+ })
41
42
+}
0 commit comments