Skip to content

Commit 5e5aff3

Browse files
committed
address review feedback
1 parent 9f16ffa commit 5e5aff3

File tree

3 files changed

+21
-34
lines changed

3 files changed

+21
-34
lines changed

src/net/udp.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@ use crate::{event, sys, Interest, Registry, Token};
3131
///
3232
/// # Examples
3333
///
34-
// Temporarily disabled on WASI pending https://github.com/WebAssembly/wasi-libc/pull/740:
35-
#[cfg_attr(all(feature = "os-poll", not(target_os = "wasi")), doc = "```")]
36-
#[cfg_attr(
37-
not(all(feature = "os-poll", not(target_os = "wasi"))),
38-
doc = "```ignore"
39-
)]
34+
#[cfg_attr(feature = "os-poll", doc = "```")]
35+
#[cfg_attr(not(feature = "os-poll"), doc = "```ignore")]
4036
/// # use std::error::Error;
4137
/// #
4238
/// # fn main() -> Result<(), Box<dyn Error>> {
39+
/// # // Temporarily disabled on WASI pending https://github.com/WebAssembly/wasi-libc/pull/740:
40+
/// # if cfg!(target_os = "wasi") { return Ok(()) }
4341
/// // An Echo program:
4442
/// // SENDER -> sends a message.
4543
/// // ECHOER -> listens and prints the message received.
@@ -343,15 +341,13 @@ impl UdpSocket {
343341
///
344342
/// # Examples
345343
///
346-
// WASI does not yet support broacast
347-
#[cfg_attr(all(feature = "os-poll", not(target_os = "wasi")), doc = "```")]
348-
#[cfg_attr(
349-
not(all(feature = "os-poll", not(target_os = "wasi"))),
350-
doc = "```ignore"
351-
)]
344+
#[cfg_attr(feature = "os-poll", doc = "```")]
345+
#[cfg_attr(not(feature = "os-poll"), doc = "```ignore")]
352346
/// # use std::error::Error;
353347
/// #
354348
/// # fn main() -> Result<(), Box<dyn Error>> {
349+
/// # // WASI does not yet support broacast
350+
/// # if cfg!(target_os = "wasi") { return Ok(()) }
355351
/// use mio::net::UdpSocket;
356352
///
357353
/// let broadcast_socket = UdpSocket::bind("127.0.0.1:0".parse()?)?;
@@ -377,15 +373,13 @@ impl UdpSocket {
377373
///
378374
/// # Examples
379375
///
380-
// WASI does not yet support broacast
381-
#[cfg_attr(all(feature = "os-poll", not(target_os = "wasi")), doc = "```")]
382-
#[cfg_attr(
383-
not(all(feature = "os-poll", not(target_os = "wasi"))),
384-
doc = "```ignore"
385-
)]
376+
#[cfg_attr(feature = "os-poll", doc = "```")]
377+
#[cfg_attr(not(feature = "os-poll"), doc = "```ignore")]
386378
/// # use std::error::Error;
387379
/// #
388380
/// # fn main() -> Result<(), Box<dyn Error>> {
381+
/// # // WASI does not yet support broacast
382+
/// # if cfg!(target_os = "wasi") { return Ok(()) }
389383
/// use mio::net::UdpSocket;
390384
///
391385
/// let broadcast_socket = UdpSocket::bind("127.0.0.1:0".parse()?)?;

src/poll.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,16 +383,12 @@ impl Poll {
383383
///
384384
/// A basic example -- establishing a `TcpStream` connection.
385385
///
386-
#[cfg_attr(
387-
all(feature = "os-poll", feature = "net", not(target_os = "wasi")),
388-
doc = "```"
389-
)]
390-
#[cfg_attr(
391-
not(all(feature = "os-poll", feature = "net", not(target_os = "wasi"))),
392-
doc = "```ignore"
393-
)]
386+
#[cfg_attr(all(feature = "os-poll", feature = "net"), doc = "```")]
387+
#[cfg_attr(not(all(feature = "os-poll", feature = "net")), doc = "```ignore")]
394388
/// # use std::error::Error;
395389
/// # fn main() -> Result<(), Box<dyn Error>> {
390+
/// # // WASI does not yet support multithreading:
391+
/// # if cfg!(target_os = "wasi") { return Ok(()) }
396392
/// use mio::{Events, Poll, Interest, Token};
397393
/// use mio::net::TcpStream;
398394
///

src/sys/unix/sourcefd.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,13 @@ use crate::{event, Interest, Registry, Token};
7272
///
7373
/// Implementing [`event::Source`] for a custom type backed by a [`RawFd`].
7474
///
75-
#[cfg_attr(
76-
all(feature = "os-poll", feature = "os-ext", not(target_os = "wasi")),
77-
doc = "```"
78-
)]
79-
#[cfg_attr(
80-
not(all(feature = "os-poll", feature = "os-ext", not(target_os = "wasi"))),
81-
doc = "```ignore"
82-
)]
75+
#[cfg_attr(all(feature = "os-poll", feature = "os-ext"), doc = "```")]
76+
#[cfg_attr(not(all(feature = "os-poll", feature = "os-ext")), doc = "```ignore")]
8377
/// use mio::{event, Interest, Registry, Token};
78+
/// #[cfg(unix)]
8479
/// use mio::unix::SourceFd;
80+
/// #[cfg(target_os = "wasi")]
81+
/// use mio::wasi::SourceFd;
8582
///
8683
/// use std::os::fd::RawFd;
8784
/// use std::io;

0 commit comments

Comments
 (0)