Skip to content

Commit e896b68

Browse files
committed
doc: add for winio-pollable
1 parent 7ece87f commit e896b68

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

winio-pollable/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//! A pollable runtime based on [`compio`]. It is just a compio runtime except
2+
//! Linux, where there is also an eventfd if the driver is io-uring. This crate
3+
//! ensures that the raw fd returned by [`RawFd::as_raw_fd`] is always actively
4+
//! pollable.
5+
6+
#![warn(missing_docs)]
7+
18
#[cfg(target_os = "linux")]
29
use std::os::fd::OwnedFd;
310
use std::{
@@ -7,6 +14,9 @@ use std::{
714

815
use compio::driver::{AsRawFd, RawFd};
916

17+
/// See [`Runtime`]
18+
///
19+
/// [`Runtime`]: compio::runtime::Runtime
1020
pub struct Runtime {
1121
runtime: compio::runtime::Runtime,
1222
#[cfg(target_os = "linux")]
@@ -15,6 +25,7 @@ pub struct Runtime {
1525

1626
#[cfg(target_os = "linux")]
1727
impl Runtime {
28+
/// Create [`Runtime`].
1829
pub fn new() -> io::Result<Self> {
1930
let efd = if compio::driver::DriverType::is_iouring() {
2031
use rustix::event::{EventfdFlags, eventfd};
@@ -32,6 +43,7 @@ impl Runtime {
3243
Ok(Self { runtime, efd })
3344
}
3445

46+
/// Clear the eventfd, if possible.
3547
pub fn clear(&self) -> io::Result<()> {
3648
if let Some(efd) = &self.efd {
3749
let mut buf = [0u8; 8];
@@ -43,12 +55,14 @@ impl Runtime {
4355

4456
#[cfg(not(target_os = "linux"))]
4557
impl Runtime {
58+
/// Create [`Runtime`].
4659
pub fn new() -> io::Result<Self> {
4760
Ok(Self {
4861
runtime: compio::runtime::Runtime::new()?,
4962
})
5063
}
5164

65+
/// Clear the eventfd, if possible.
5266
pub fn clear(&self) -> io::Result<()> {
5367
Ok(())
5468
}

0 commit comments

Comments
 (0)