io_uring_fd/
lib.rs

1#![warn(
2    clippy::unwrap_used,
3    missing_docs,
4    rust_2018_idioms,
5    unused_lifetimes,
6    unused_qualifications
7)]
8#![doc = include_str!("../README.md")]
9
10use std::os::fd::RawFd;
11
12/// Filehandle registered (or mapped as fixed) with the io_uring API
13#[derive(Clone, Debug)]
14pub struct RegisteredFd {
15    /// Type of registered handle
16    pub kind: FdKind,
17    /// RawFD of the registered handle
18    pub raw_fd: RawFd,
19}
20
21impl RegisteredFd {
22    /// Create Registered filehandle from RawFd
23    #[inline]
24    pub fn from_raw(raw_fd: RawFd, kind: FdKind) -> Self {
25        Self { kind, raw_fd }
26    }
27}
28
29/// Type of Fd mainly used by the safe API
30#[derive(Clone, Debug)]
31pub enum FdKind {
32    /// Epoll ctl handle                  
33    EpollCtl,
34    /// Acceptor handle             
35    Acceptor,
36    /// Recv Handle
37    Recv,
38    /// Send handle
39    Send,
40    /// Recv-Send Handle
41    RecvSend,
42}