MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / test_splice_pipe2pipe

Function test_splice_pipe2pipe

tests/pipe/splice.rs:70–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68#[cfg(linux_kernel)]
69#[test]
70fn test_splice_pipe2pipe() {
71 use rustix::io::{read, write};
72 use rustix::pipe::{pipe, splice, SpliceFlags};
73
74 let (read_p1, write_p1) = pipe().unwrap();
75 let (read_p2, write_p2) = pipe().unwrap();
76 let mut buff = [0; 5];
77
78 write(&write_p1, b"hello").unwrap();
79 splice(&read_p1, None, write_p2, None, 5, SpliceFlags::empty()).unwrap();
80 read(&read_p2, &mut buff).unwrap();
81
82 assert_eq!(&buff, b"hello");
83}
84
85#[cfg(feature = "fs")]
86#[cfg(linux_kernel)]

Callers

nothing calls this directly

Calls 4

pipeFunction · 0.50
writeFunction · 0.50
spliceFunction · 0.50
readFunction · 0.50

Tested by

no test coverage detected