Coverage Report

Created: 2025-11-16 06:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/mio-1.0.3/src/sys/mod.rs
Line
Count
Source
1
//! Module with system specific types.
2
//!
3
//! Required types:
4
//!
5
//! * `Event`: a type alias for the system specific event, e.g. `kevent` or
6
//!            `epoll_event`.
7
//! * `event`: a module with various helper functions for `Event`, see
8
//!            [`crate::event::Event`] for the required functions.
9
//! * `Events`: collection of `Event`s, see [`crate::Events`].
10
//! * `IoSourceState`: state for the `IoSource` type.
11
//! * `Selector`: selector used to register event sources and poll for events,
12
//!               see [`crate::Poll`] and [`crate::Registry`] for required
13
//!               methods.
14
//! * `tcp` and `udp` modules: see the [`crate::net`] module.
15
//! * `Waker`: see [`crate::Waker`].
16
17
cfg_os_poll! {
18
    macro_rules! debug_detail {
19
        (
20
            $type: ident ($event_type: ty), $test: path,
21
            $($(#[$target: meta])* $libc: ident :: $flag: ident),+ $(,)*
22
        ) => {
23
            struct $type($event_type);
24
25
            impl fmt::Debug for $type {
26
0
                fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
27
0
                    let mut written_one = false;
28
                    $(
29
                        $(#[$target])*
30
                        #[allow(clippy::bad_bit_mask)] // Apparently some flags are zero.
31
                        {
32
                            // Windows doesn't use `libc` but the `afd` module.
33
0
                            if $test(&self.0, &$libc :: $flag) {
34
0
                                if !written_one {
35
0
                                    write!(f, "{}", stringify!($flag))?;
36
0
                                    written_one = true;
37
                                } else {
38
0
                                    write!(f, "|{}", stringify!($flag))?;
39
                                }
40
0
                            }
41
                        }
42
                    )+
43
0
                    if !written_one {
44
0
                        write!(f, "(empty)")
45
                    } else {
46
0
                        Ok(())
47
                    }
48
0
                }
49
            }
50
        };
51
    }
52
}
53
54
#[cfg(any(unix, target_os = "hermit"))]
55
cfg_os_poll! {
56
    mod unix;
57
    #[allow(unused_imports)]
58
    pub use self::unix::*;
59
}
60
61
#[cfg(windows)]
62
cfg_os_poll! {
63
    mod windows;
64
    pub use self::windows::*;
65
}
66
67
#[cfg(target_os = "wasi")]
68
cfg_os_poll! {
69
    mod wasi;
70
    pub(crate) use self::wasi::*;
71
}
72
73
cfg_not_os_poll! {
74
    mod shell;
75
    pub(crate) use self::shell::*;
76
77
    #[cfg(unix)]
78
    cfg_any_os_ext! {
79
        mod unix;
80
        #[cfg(feature = "os-ext")]
81
        pub use self::unix::SourceFd;
82
    }
83
}