Skip to content

Commit 8fe7dec

Browse files
committed
Reduce the scope of the allow(missing_docs) and add more docs.
1 parent 8a49a87 commit 8fe7dec

File tree

15 files changed

+78
-11
lines changed

15 files changed

+78
-11
lines changed

src/imp/libc/io/epoll.rs

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
//! # }
5555
//! ```
5656
57+
#![allow(missing_docs)] // TODO: Write more docs.
58+
5759
use super::super::c;
5860
use super::super::conv::{ret, ret_owned_fd, ret_u32};
5961
use super::super::fd::{AsFd, AsRawFd, BorrowedFd, RawFd};

src/imp/libc/io/error.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
//! This type holds an OS error code, which conceptually corresponds to an
44
//! `errno` value.
55
6+
#![allow(missing_docs)]
7+
68
use super::super::c;
79
use errno::errno;
810

src/imp/libc/io/types.rs

+4
Original file line numberDiff line numberDiff line change
@@ -429,11 +429,15 @@ pub type Termios = c::termios;
429429
#[cfg(not(target_os = "wasi"))]
430430
pub type Winsize = c::winsize;
431431

432+
/// `tcflag_t`—A type for the flags fields of [`Termios`].
432433
#[cfg(not(target_os = "wasi"))]
433434
pub type Tcflag = c::tcflag_t;
434435

436+
/// `ICANON`—A flag for the `c_lflag` field of [`Termios`] indicating
437+
/// canonical mode.
435438
#[cfg(not(target_os = "wasi"))]
436439
pub const ICANON: Tcflag = c::ICANON;
437440

441+
/// `PIPE_BUF`—The maximum size of a write to a pipe guaranteed to be atomic.
438442
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
439443
pub const PIPE_BUF: usize = c::PIPE_BUF;

src/imp/libc/io_lifetimes.rs

+33
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ pub(crate) use io_lifetimes::OwnedSocket as OwnedFd;
99
pub use std::os::windows::io::RawSocket as RawFd;
1010
pub(crate) use winapi::um::winsock2::SOCKET as LibcFd;
1111

12+
/// A version of [`AsRawFd`] for use with Winsock APIs.
13+
///
14+
/// [`AsRawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.AsRawFd.html
1215
pub trait AsRawFd {
16+
/// A version of [`as_raw_fd`] for use with Winsock APIs.
17+
///
18+
/// [`as_raw_fd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.FromRawFd.html#tymethod.as_raw_fd
1319
fn as_raw_fd(&self) -> RawFd;
1420
}
1521
#[cfg(feature = "std")]
@@ -20,7 +26,13 @@ impl<T: std::os::windows::io::AsRawSocket> AsRawFd for T {
2026
}
2127
}
2228

29+
/// A version of [`IntoRawFd`] for use with Winsock APIs.
30+
///
31+
/// [`IntoRawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.IntoRawFd.html
2332
pub trait IntoRawFd {
33+
/// A version of [`into_raw_fd`] for use with Winsock APIs.
34+
///
35+
/// [`into_raw_fd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.FromRawFd.html#tymethod.into_raw_fd
2436
fn into_raw_fd(self) -> RawFd;
2537
}
2638
#[cfg(feature = "std")]
@@ -31,7 +43,13 @@ impl<T: std::os::windows::io::IntoRawSocket> IntoRawFd for T {
3143
}
3244
}
3345

46+
/// A version of [`FromRawFd`] for use with Winsock APIs.
47+
///
48+
/// [`FromRawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.FromRawFd.html
3449
pub trait FromRawFd {
50+
/// A version of [`from_raw_fd`] for use with Winsock APIs.
51+
///
52+
/// [`from_raw_fd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.FromRawFd.html#tymethod.from_raw_fd
3553
unsafe fn from_raw_fd(raw_fd: RawFd) -> Self;
3654
}
3755
#[cfg(feature = "std")]
@@ -42,6 +60,9 @@ impl<T: std::os::windows::io::FromRawSocket> FromRawFd for T {
4260
}
4361
}
4462

63+
/// A version of [`AsFd`] for use with Winsock APIs.
64+
///
65+
/// [`AsFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.AsFd.html
4566
pub use io_lifetimes::AsSocket as AsFd;
4667

4768
/// We define `AsFd` as an alias for `AsSocket`, but that doesn't provide
@@ -57,7 +78,13 @@ impl<T: io_lifetimes::AsSocket> AsSocketAsFd for T {
5778
}
5879
}
5980

81+
/// A version of [`IntoFd`] for use with Winsock APIs.
82+
///
83+
/// [`IntoFd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/trait.IntoFd.html
6084
pub trait IntoFd {
85+
/// A version of [`into_fd`] for use with Winsock APIs.
86+
///
87+
/// [`into_fd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/trait.IntoFd.html#tymethod.into_fd
6188
fn into_fd(self) -> OwnedFd;
6289
}
6390
impl<T: io_lifetimes::IntoSocket> IntoFd for T {
@@ -67,7 +94,13 @@ impl<T: io_lifetimes::IntoSocket> IntoFd for T {
6794
}
6895
}
6996

97+
/// A version of [`FromFd`] for use with Winsock APIs.
98+
///
99+
/// [`FromFd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/trait.FromFd.html
70100
pub trait FromFd {
101+
/// A version of [`from_fd`] for use with Winsock APIs.
102+
///
103+
/// [`from_fd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/trait.FromFd.html#tymethod.from_fd
71104
fn from_fd(fd: OwnedFd) -> Self;
72105
}
73106
impl<T: io_lifetimes::FromSocket> FromFd for T {

src/imp/libc/process/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,7 @@ pub(crate) use types::{raw_cpu_set_new, RawCpuSet, CPU_SETSIZE};
3535
#[cfg(any(target_os = "android", target_os = "linux"))]
3636
pub use types::{MembarrierCommand, RawCpuid};
3737
#[cfg(not(target_os = "wasi"))]
38-
pub use types::{RawGid, RawPid, RawUid, RawUname, EXIT_SIGNALED_SIGABRT};
38+
pub(crate) use types::RawUname;
39+
#[cfg(not(target_os = "wasi"))]
40+
pub use types::{RawGid, RawPid, RawUid, EXIT_SIGNALED_SIGABRT};
3941
pub use types::{EXIT_FAILURE, EXIT_SUCCESS};

src/imp/libc/process/types.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,21 @@ pub const EXIT_FAILURE: c::c_int = c::EXIT_FAILURE;
140140
#[cfg(not(target_os = "wasi"))]
141141
pub const EXIT_SIGNALED_SIGABRT: c::c_int = 128 + c::SIGABRT;
142142

143+
/// A process identifier as a raw integer.
143144
#[cfg(not(target_os = "wasi"))]
144145
pub type RawPid = c::pid_t;
146+
/// A group identifier as a raw integer.
145147
#[cfg(not(target_os = "wasi"))]
146148
pub type RawGid = c::gid_t;
149+
/// A user identifier as a raw integer.
147150
#[cfg(not(target_os = "wasi"))]
148151
pub type RawUid = c::uid_t;
152+
/// A CPU identifier as a raw integer.
149153
#[cfg(any(target_os = "android", target_os = "linux"))]
150154
pub type RawCpuid = u32;
151155

152156
#[cfg(not(target_os = "wasi"))]
153-
pub type RawUname = c::utsname;
157+
pub(crate) type RawUname = c::utsname;
154158

155159
#[cfg(any(
156160
target_os = "linux",

src/imp/libc/rand/types.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ use bitflags::bitflags;
55

66
#[cfg(target_os = "linux")]
77
bitflags! {
8+
/// `GRND_*` flags for use with [`getrandom`].
9+
///
10+
/// [`getrandom`]: crate::rand::getrandom
811
pub struct GetRandomFlags: u32 {
9-
/// GRND_RANDOM
12+
/// `GRND_RANDOM`
1013
const RANDOM = c::GRND_RANDOM;
11-
/// GRND_NONBLOCK
14+
/// `GRND_NONBLOCK`
1215
const NONBLOCK = c::GRND_NONBLOCK;
1316
}
1417
}

src/imp/linux_raw/io/epoll.rs

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
//! ```
5656
5757
#![allow(unsafe_code)]
58+
#![allow(missing_docs)] // TODO: Write more docs.
5859

5960
use super::super::c;
6061
use crate::fd::{AsFd, AsRawFd, BorrowedFd, RawFd};

src/imp/linux_raw/io/error.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
//! Linux uses error codes in `-4095..0`; we use rustc attributes to describe
99
//! this restricted range of values.
1010
#![allow(unsafe_code)]
11+
#![allow(missing_docs)]
1112
#![cfg_attr(not(rustc_attrs), allow(unused_unsafe))]
1213

1314
use super::super::c;

src/imp/linux_raw/io/types.rs

+4
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,12 @@ pub type Termios = linux_raw_sys::general::termios;
249249
/// [`ioctl_tiocgwinsz`]: crate::io::ioctl_tiocgwinsz
250250
pub type Winsize = linux_raw_sys::general::winsize;
251251

252+
/// `tcflag_t`—A type for the flags fields of [`Termios`].
252253
pub type Tcflag = linux_raw_sys::general::tcflag_t;
253254

255+
/// `ICANON`—A flag for the `c_lflag` field of [`Termios`] indicating
256+
/// canonical mode.
254257
pub const ICANON: c::c_uint = linux_raw_sys::general::ICANON;
255258

259+
/// `PIPE_BUF`—The maximum size of a write to a pipe guaranteed to be atomic.
256260
pub const PIPE_BUF: usize = linux_raw_sys::general::PIPE_BUF as usize;

src/imp/linux_raw/process/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ pub(crate) mod cpu_set;
88
pub(crate) use auxv::init;
99
pub(crate) use auxv::{exe_phdrs, linux_execfn, linux_hwcap, page_size};
1010
pub(super) use auxv::{exe_phdrs_slice, sysinfo_ehdr};
11-
pub(crate) use types::{raw_cpu_set_new, RawCpuSet, CPU_SETSIZE};
11+
pub(crate) use types::{raw_cpu_set_new, RawCpuSet, CPU_SETSIZE, RawUname};
1212
pub use types::{
13-
MembarrierCommand, RawCpuid, RawGid, RawPid, RawUid, RawUname, Resource, EXIT_FAILURE,
13+
MembarrierCommand, RawCpuid, RawGid, RawPid, RawUid, Resource, EXIT_FAILURE,
1414
EXIT_SIGNALED_SIGABRT, EXIT_SUCCESS,
1515
};
1616
pub(crate) use wait::{

src/imp/linux_raw/process/types.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,23 @@ pub enum Resource {
7474
Rttime = linux_raw_sys::general::RLIMIT_RTTIME,
7575
}
7676

77+
/// `EXIT_SUCCESS`
7778
pub const EXIT_SUCCESS: c::c_int = 0;
79+
/// `EXIT_FAILURE`
7880
pub const EXIT_FAILURE: c::c_int = 1;
81+
/// The status value of a child terminated with `SIGABRT`.
7982
pub const EXIT_SIGNALED_SIGABRT: c::c_int = 128 + linux_raw_sys::general::SIGABRT as i32;
8083

84+
/// A process identifier as a raw integer.
8185
pub type RawPid = u32;
86+
/// A group identifier as a raw integer.
8287
pub type RawGid = u32;
88+
/// A user identifier as a raw integer.
8389
pub type RawUid = u32;
90+
/// A CPU identifier as a raw integer.
8491
pub type RawCpuid = u32;
8592

86-
pub type RawUname = linux_raw_sys::general::new_utsname;
93+
pub(crate) type RawUname = linux_raw_sys::general::new_utsname;
8794

8895
#[repr(C)]
8996
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]

src/imp/linux_raw/rand/types.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
use bitflags::bitflags;
22

33
bitflags! {
4+
/// `GRND_*` flags for use with [`getrandom`].
5+
///
6+
/// [`getrandom`]: crate::rand::getrandom
47
pub struct GetRandomFlags: u32 {
5-
/// GRND_RANDOM
8+
/// `GRND_RANDOM`
69
const RANDOM = linux_raw_sys::v5_4::general::GRND_RANDOM;
7-
/// GRND_NONBLOCK
10+
/// `GRND_NONBLOCK`
811
const NONBLOCK = linux_raw_sys::v5_4::general::GRND_NONBLOCK;
912
}
1013
}

src/imp/linux_raw/time/types.rs

+3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ use super::super::fd::BorrowedFd;
33
/// `struct timespec`
44
pub type Timespec = linux_raw_sys::general::__kernel_timespec;
55

6+
/// A type for the `tv_sec` field of [`Timespec`].
67
pub type Secs = linux_raw_sys::general::__kernel_time64_t;
8+
9+
/// A type for the `tv_nsec` field of [`Timespec`].
710
pub type Nsecs = i64;
811

912
/// `CLOCK_*` constants for use with [`clock_gettime`].

src/imp/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! The "imp"-lementation module. This selects the backend to use.
22
3-
#![allow(missing_docs)]
4-
53
#[cfg(libc)]
64
mod libc;
75
#[cfg(linux_raw)]

0 commit comments

Comments
 (0)