Skip to content

Commit

Permalink
docs: fix Exit examples
Browse files Browse the repository at this point in the history
  • Loading branch information
rogercoll committed Oct 12, 2024
1 parent 374ebbb commit 1fedf03
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/os/kqueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ impl<T: Queueable> Filter<T> {
///
/// ```no_run
/// use std::process::Command;
/// use std::num::NonZeroI32;
/// use async_io::os::kqueue::{Exit, Filter};
///
/// // Create a new process to wait for.
/// let mut child = Command::new("sleep").arg("5").spawn().unwrap();
///
/// // Wrap the process in an `Async` object that waits for it to exit.
/// let process = Filter::new(Exit::new(child)).unwrap();
/// let mut process = Filter::new(Exit::new(NonZeroI32::new(child.id().try_into().unwrap()).unwrap())).unwrap();
///
/// // Wait for the process to exit.
/// # async_io::block_on(async {
Expand Down Expand Up @@ -97,10 +98,11 @@ impl<T> Filter<T> {
///
/// ```
/// use async_io::os::kqueue::{Exit, Filter};
/// use std::num::NonZeroI32;
///
/// # futures_lite::future::block_on(async {
/// let child = std::process::Command::new("sleep").arg("5").spawn().unwrap();
/// let process = Filter::new(Exit::new(child)).unwrap();
/// let mut process = Filter::new(Exit::new(NonZeroI32::new(child.id().try_into().unwrap()).unwrap())).unwrap();
/// let inner = process.get_ref();
/// # });
/// ```
Expand All @@ -117,10 +119,11 @@ impl<T> Filter<T> {
///
/// ```
/// use async_io::os::kqueue::{Exit, Filter};
/// use std::num::NonZeroI32;
///
/// # futures_lite::future::block_on(async {
/// let child = std::process::Command::new("sleep").arg("5").spawn().unwrap();
/// let mut process = Filter::new(Exit::new(child)).unwrap();
/// let mut process = Filter::new(Exit::new(NonZeroI32::new(child.id().try_into().unwrap()).unwrap())).unwrap();
/// let inner = process.get_mut();
/// # });
/// ```
Expand All @@ -134,10 +137,11 @@ impl<T> Filter<T> {
///
/// ```
/// use async_io::os::kqueue::{Exit, Filter};
/// use std::num::NonZeroI32;
///
/// # futures_lite::future::block_on(async {
/// let child = std::process::Command::new("sleep").arg("5").spawn().unwrap();
/// let process = Filter::new(Exit::new(child)).unwrap();
/// let mut process = Filter::new(Exit::new(NonZeroI32::new(child.id().try_into().unwrap()).unwrap())).unwrap();
/// let inner = process.into_inner().unwrap();
/// # });
/// ```
Expand All @@ -153,12 +157,13 @@ impl<T> Filter<T> {
/// # Examples
///
/// ```no_run
/// use std::num::NonZeroI32;
/// use std::process::Command;
/// use async_io::os::kqueue::{Exit, Filter};
///
/// # futures_lite::future::block_on(async {
/// let child = Command::new("sleep").arg("5").spawn()?;
/// let process = Filter::new(Exit::new(child))?;
/// let process = Filter::new(Exit::new(NonZeroI32::new(child.id().try_into().unwrap()).unwrap())).unwrap();
///
/// // Wait for the process to exit.
/// process.ready().await?;
Expand All @@ -182,13 +187,14 @@ impl<T> Filter<T> {
/// # Examples
///
/// ```no_run
/// use std::num::NonZeroI32;
/// use std::process::Command;
/// use async_io::os::kqueue::{Exit, Filter};
/// use futures_lite::future;
///
/// # futures_lite::future::block_on(async {
/// let child = Command::new("sleep").arg("5").spawn()?;
/// let process = Filter::new(Exit::new(child))?;
/// let process = Filter::new(Exit::new(NonZeroI32::new(child.id().try_into().unwrap()).unwrap())).unwrap();
///
/// // Wait for the process to exit.
/// future::poll_fn(|cx| process.poll_ready(cx)).await?;
Expand Down

0 comments on commit 1fedf03

Please sign in to comment.