Coverage Report

Created: 2025-07-23 07:00

/rust/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.4/src/sys/mod.rs
Line
Count
Source (jump to first uncovered line)
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 methods.
13
//! * `tcp` and `udp` modules: see the [`crate::net`] module.
14
//! * `Waker`: see [`crate::Waker`].
15
16
cfg_os_poll! {
17
    macro_rules! debug_detail {
18
        (
19
            $type: ident ($event_type: ty), $test: path,
20
            $($(#[$target: meta])* $libc: ident :: $flag: ident),+ $(,)*
21
        ) => {
22
            struct $type($event_type);
23
24
            impl fmt::Debug for $type {
25
0
                fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26
0
                    let mut written_one = false;
27
                    $(
28
                        $(#[$target])*
29
                        #[allow(clippy::bad_bit_mask)] // Apparently some flags are zero.
30
                        {
31
                            // Windows doesn't use `libc` but the `afd` module.
32
0
                            if $test(&self.0, &$libc :: $flag) {
33
0
                                if !written_one {
34
0
                                    write!(f, "{}", stringify!($flag))?;
35
0
                                    written_one = true;
36
                                } else {
37
0
                                    write!(f, "|{}", stringify!($flag))?;
38
                                }
39
0
                            }
40
                        }
41
                    )+
42
0
                    if !written_one {
43
0
                        write!(f, "(empty)")
44
                    } else {
45
0
                        Ok(())
46
                    }
47
0
                }
48
            }
49
        };
50
    }
51
}
52
53
#[cfg(any(unix, target_os = "hermit"))]
54
cfg_os_poll! {
55
    mod unix;
56
    #[allow(unused_imports)]
57
    pub use self::unix::*;
58
}
59
60
#[cfg(windows)]
61
cfg_os_poll! {
62
    mod windows;
63
    pub use self::windows::*;
64
}
65
66
#[cfg(target_os = "wasi")]
67
cfg_os_poll! {
68
    mod wasi;
69
    pub(crate) use self::wasi::*;
70
}
71
72
cfg_not_os_poll! {
73
    mod shell;
74
    pub(crate) use self::shell::*;
75
76
    #[cfg(unix)]
77
    cfg_any_os_ext! {
78
        mod unix;
79
        #[cfg(feature = "os-ext")]
80
        pub use self::unix::SourceFd;
81
    }
82
}