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

Function read

src/io/read_write.rs:39–44  ·  view source on GitHub ↗
(fd: Fd, mut buf: Buf)

Source from the content-addressed store, hash-verified

37/// [glibc]: https://sourceware.org/glibc/manual/latest/html_node/I_002fO-Primitives.html#index-reading-from-a-file-descriptor
38#[inline]
39pub fn read<Fd: AsFd, Buf: Buffer<u8>>(fd: Fd, mut buf: Buf) -> io::Result<Buf::Output> {
40 // SAFETY: `read` behaves.
41 let len = unsafe { backend::io::syscalls::read(fd.as_fd(), buf.parts_mut())? };
42 // SAFETY: `read` behaves.
43 unsafe { Ok(buf.assume_init(len)) }
44}
45
46/// `write(fd, buf)`—Writes to a stream.
47///

Callers

nothing calls this directly

Calls 3

parts_mutMethod · 0.80
assume_initMethod · 0.80
as_fdMethod · 0.45

Tested by

no test coverage detected