Skip to content

Commit e95edfb

Browse files
authored
Miscellaneous documentation cleanups. (#860)
1 parent a74f97f commit e95edfb

13 files changed

Lines changed: 51 additions & 33 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ targets = [
121121
# users are better served by just using libc for this.
122122
default = ["std", "use-libc-auxv"]
123123

124-
# This enables use of std. Disabling this enables `#![no_std], and requires
124+
# This enables use of std. Disabling this enables `#![no_std]`, and requires
125125
# Rust 1.64 or newer.
126126
std = ["bitflags/std", "alloc", "libc?/std", "libc_errno?/std"]
127127

@@ -202,8 +202,8 @@ all-apis = [
202202
"rand",
203203
"runtime",
204204
"shm",
205-
"system",
206205
"stdio",
206+
"system",
207207
"termios",
208208
"thread",
209209
"time",

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ by default. The rest of the API is conditional with cargo feature flags:
6969
| `procfs` | [`rustix::procfs`]—Utilities for reading `/proc` on Linux.
7070
| `pty` | [`rustix::pty`]—Pseudoterminal operations.
7171
| `rand` | [`rustix::rand`]—Random-related operations.
72+
| `shm` | [`rustix::shm`]—POSIX shared memory.
7273
| `stdio` | [`rustix::stdio`]—Stdio-related operations.
7374
| `system` | [`rustix::system`]—System-related operations.
7475
| `termios` | [`rustix::termios`]—Terminal I/O stream operations.
@@ -89,6 +90,7 @@ by default. The rest of the API is conditional with cargo feature flags:
8990
[`rustix::procfs`]: https://docs.rs/rustix/*/rustix/procfs/index.html
9091
[`rustix::pty`]: https://docs.rs/rustix/*/rustix/pty/index.html
9192
[`rustix::rand`]: https://docs.rs/rustix/*/rustix/rand/index.html
93+
[`rustix::shm`]: https://docs.rs/rustix/*/rustix/shm/index.html
9294
[`rustix::stdio`]: https://docs.rs/rustix/*/rustix/stdio/index.html
9395
[`rustix::system`]: https://docs.rs/rustix/*/rustix/system/index.html
9496
[`rustix::termios`]: https://docs.rs/rustix/*/rustix/termios/index.html

src/backend/libc/net/send_recv.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ use crate::backend::c;
22
use bitflags::bitflags;
33

44
bitflags! {
5-
/// `MSG_* flags for use with [`send`], [`send_to`], and related functions.
5+
/// `MSG_*` flags for use with [`send`], [`send_to`], and related
6+
/// functions.
67
///
78
/// [`send`]: crate::net::send
89
/// [`sendto`]: crate::net::sendto
@@ -50,7 +51,8 @@ bitflags! {
5051
}
5152

5253
bitflags! {
53-
/// `MSG_* flags for use with [`recv`], [`recvfrom`], and related functions.
54+
/// `MSG_*` flags for use with [`recv`], [`recvfrom`], and related
55+
/// functions.
5456
///
5557
/// [`recv`]: crate::net::recv
5658
/// [`recvfrom`]: crate::net::recvfrom

src/backend/linux_raw/net/send_recv.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ use crate::backend::c;
22
use bitflags::bitflags;
33

44
bitflags! {
5-
/// `MSG_* flags for use with [`send`], [`send_to`], and related functions.
5+
/// `MSG_*` flags for use with [`send`], [`send_to`], and related
6+
/// functions.
67
///
78
/// [`send`]: crate::net::send
89
/// [`sendto`]: crate::net::sendto
@@ -30,7 +31,8 @@ bitflags! {
3031
}
3132

3233
bitflags! {
33-
/// `MSG_* flags for use with [`recv`], [`recvfrom`], and related functions.
34+
/// `MSG_*` flags for use with [`recv`], [`recvfrom`], and related
35+
/// functions.
3436
///
3537
/// [`recv`]: crate::net::recv
3638
/// [`recvfrom`]: crate::net::recvfrom

src/fs/mount.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
//!
33
//! These have been moved to a new `rustix::mount` module.
44
5-
#[deprecated(note = "rustix::fs::UnmountFlags` moved to `rustix::mount::UnmountFlags`.")]
5+
#[deprecated(note = "`rustix::fs::UnmountFlags` moved to `rustix::mount::UnmountFlags`.")]
66
#[doc(hidden)]
77
pub use crate::mount::UnmountFlags;
88

9-
#[deprecated(note = "rustix::fs::MountFlags` moved to `rustix::mount::MountFlags`.")]
9+
#[deprecated(note = "`rustix::fs::MountFlags` moved to `rustix::mount::MountFlags`.")]
1010
#[doc(hidden)]
1111
pub use crate::mount::MountFlags;
1212

1313
#[deprecated(
14-
note = "rustix::fs::MountPropagationFlags` moved to `rustix::mount::MountPropagationFlags`."
14+
note = "`rustix::fs::MountPropagationFlags` moved to `rustix::mount::MountPropagationFlags`."
1515
)]
1616
#[doc(hidden)]
1717
pub use crate::mount::MountPropagationFlags;

src/fs/statx.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ use compat::statx as _statx;
2828
/// # use std::io;
2929
/// # use rustix::fs::{AtFlags, StatxFlags};
3030
/// # use rustix::fd::BorrowedFd;
31-
/// /// Try to determine if the provided path is a mount root. Will return `Ok(None)` if
32-
/// /// the kernel is not new enough to support statx() or [`libc::STATX_ATTR_MOUNT_ROOT`].
31+
/// /// Try to determine if the provided path is a mount root. Will return
32+
/// /// `Ok(None)` if the kernel is not new enough to support `statx` or
33+
/// /// [`libc::STATX_ATTR_MOUNT_ROOT`].
3334
/// fn is_mountpoint(root: BorrowedFd<'_>, path: &Path) -> io::Result<Option<bool>> {
3435
/// use rustix::fs::{AtFlags, StatxFlags};
3536
///

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ pub mod rand;
253253
target_os = "wasi"
254254
)))]
255255
#[cfg(feature = "shm")]
256+
#[cfg_attr(doc_cfg, doc(cfg(feature = "shm")))]
256257
pub mod shm;
257258
#[cfg(not(windows))]
258259
#[cfg(feature = "stdio")]

src/mm/mmap.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ pub use backend::mm::types::{MapFlags, MprotectFlags, ProtFlags};
1919
impl MapFlags {
2020
/// Create `MAP_HUGETLB` with provided size of huge page.
2121
///
22-
/// Under the hood it computes `MAP_HUGETLB | (huge_page_size_log2 << MAP_HUGE_SHIFT)`.
23-
/// `huge_page_size_log2` denotes logarithm of huge page size to use and should be
24-
/// between 16 and 63 (inclusively).
22+
/// Under the hood it computes
23+
/// `MAP_HUGETLB | (huge_page_size_log2 << MAP_HUGE_SHIFT)`.
24+
/// `huge_page_size_log2` denotes logarithm of huge page size to use and
25+
/// should be between 16 and 63 (inclusive).
2526
///
2627
/// ```
2728
/// use rustix::mm::MapFlags;

src/net/send_recv/msg.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ pub enum RecvAncillaryMessage<'a> {
7171
ScmRights(AncillaryIter<'a, OwnedFd>),
7272
}
7373

74-
/// Buffer for sending ancillary messages.
74+
/// Buffer for sending ancillary messages with [`sendmsg`], [`sendmsg_v4`],
75+
/// [`sendmsg_v6`], [`sendmsg_unix`], and [`sendmsg_any`].
7576
pub struct SendAncillaryBuffer<'buf, 'slice, 'fd> {
7677
/// Raw byte buffer for messages.
7778
buffer: &'buf mut [u8],
@@ -191,7 +192,7 @@ impl<'slice, 'fd> Extend<SendAncillaryMessage<'slice, 'fd>>
191192
}
192193
}
193194

194-
/// Buffer for receiving ancillary messages.
195+
/// Buffer for receiving ancillary messages with [`recvmsg`].
195196
pub struct RecvAncillaryBuffer<'buf> {
196197
/// Raw byte buffer for messages.
197198
buffer: &'buf mut [u8],
@@ -274,7 +275,7 @@ impl Drop for RecvAncillaryBuffer<'_> {
274275
}
275276
}
276277

277-
/// An iterator that drains messages from a `RecvAncillaryBuffer`.
278+
/// An iterator that drains messages from a [`RecvAncillaryBuffer`].
278279
pub struct AncillaryDrain<'buf> {
279280
/// Inner iterator over messages.
280281
messages: messages::Messages<'buf>,
@@ -287,7 +288,7 @@ pub struct AncillaryDrain<'buf> {
287288
}
288289

289290
impl<'buf> AncillaryDrain<'buf> {
290-
/// A closure that converts a message into a `RecvAncillaryMessage`.
291+
/// A closure that converts a message into a [`RecvAncillaryMessage`].
291292
fn cvt_msg(
292293
read: &mut usize,
293294
length: &mut usize,

src/net/sockopt.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -742,8 +742,8 @@ pub fn get_ipv6_multicast_hops<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
742742

743743
/// `setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, multiaddr, interface)`
744744
///
745-
/// This is similar to [`set_ip_add_membership`] but always sets `ifindex` value
746-
/// to zero.
745+
/// This is similar to [`set_ip_add_membership`] but always sets `ifindex`
746+
/// value to zero.
747747
///
748748
/// See the [module-level documentation] for more.
749749
///
@@ -851,8 +851,8 @@ pub fn set_ipv6_add_membership<Fd: AsFd>(
851851

852852
/// `setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, multiaddr, interface)`
853853
///
854-
/// This is similar to [`set_ip_drop_membership`] but always sets `ifindex` value
855-
/// to zero.
854+
/// This is similar to [`set_ip_drop_membership`] but always sets `ifindex`
855+
/// value to zero.
856856
///
857857
/// See the [module-level documentation] for more.
858858
///

0 commit comments

Comments
 (0)