Skip to content

Commit 2338a0d

Browse files
authored
Add documentation links to uninit functions. (#1114)
In non-`uninit` functions, add documentation links to their corresponding `uninit` functions.
1 parent 9f57313 commit 2338a0d

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/io/read_write.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ pub use backend::io::types::ReadWriteFlags;
1616

1717
/// `read(fd, buf)`—Reads from a stream.
1818
///
19+
/// This takes a `&mut [u8]` which Rust requires to contain initialized memory.
20+
/// To use an uninitialized buffer, use [`read_uninit`].
21+
///
1922
/// # References
2023
/// - [POSIX]
2124
/// - [Linux]
@@ -88,6 +91,9 @@ pub fn write<Fd: AsFd>(fd: Fd, buf: &[u8]) -> io::Result<usize> {
8891

8992
/// `pread(fd, buf, offset)`—Reads from a file at a given position.
9093
///
94+
/// This takes a `&mut [u8]` which Rust requires to contain initialized memory.
95+
/// To use an uninitialized buffer, use [`pread_uninit`].
96+
///
9197
/// # References
9298
/// - [POSIX]
9399
/// - [Linux]

src/net/send_recv/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ pub use msg::*;
3434

3535
/// `recv(fd, buf, flags)`—Reads data from a socket.
3636
///
37+
/// This takes a `&mut [u8]` which Rust requires to contain initialized memory.
38+
/// To use an uninitialized buffer, use [`recv_uninit`].
39+
///
3740
/// # References
3841
/// - [Beej's Guide to Network Programming]
3942
/// - [POSIX]
@@ -115,6 +118,9 @@ pub fn send<Fd: AsFd>(fd: Fd, buf: &[u8], flags: SendFlags) -> io::Result<usize>
115118
/// `recvfrom(fd, buf, flags, addr, len)`—Reads data from a socket and
116119
/// returns the sender address.
117120
///
121+
/// This takes a `&mut [u8]` which Rust requires to contain initialized memory.
122+
/// To use an uninitialized buffer, use [`recvfrom_uninit`].
123+
///
118124
/// # References
119125
/// - [Beej's Guide to Network Programming]
120126
/// - [POSIX]

src/rand/getrandom.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ pub use backend::rand::types::GetRandomFlags;
1111
/// This is a very low-level API which may be difficult to use correctly. Most
1212
/// users should prefer to use [`getrandom`] or [`rand`] APIs instead.
1313
///
14+
/// This takes a `&mut [u8]` which Rust requires to contain initialized memory.
15+
/// To use an uninitialized buffer, use [`getrandom_uninit`].
16+
///
1417
/// [`getrandom`]: https://crates.io/crates/getrandom
1518
/// [`rand`]: https://crates.io/crates/rand
1619
///

0 commit comments

Comments
 (0)