Skip to content

Commit

Permalink
Fix doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Finomnis committed Oct 13, 2023
1 parent 1010d07 commit 4baaf7f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/subsystem/nested_subsystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl<ErrType: ErrTypeTraits> NestedSubsystem<ErrType> {
/// ```
/// use miette::Result;
/// use tokio::time::{sleep, Duration};
/// use tokio_graceful_shutdown::SubsystemHandle;
/// use tokio_graceful_shutdown::{ErrorAction, SubsystemBuilder, SubsystemHandle};
///
/// async fn nested_subsystem(subsys: SubsystemHandle) -> Result<()> {
/// // This subsystem does nothing but wait for the shutdown to happen
Expand Down
20 changes: 10 additions & 10 deletions src/subsystem/subsystem_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl<ErrType: ErrTypeTraits> SubsystemHandle<ErrType> {
///
/// ```
/// use miette::Result;
/// use tokio_graceful_shutdown::SubsystemHandle;
/// use tokio_graceful_shutdown::{SubsystemBuilder, SubsystemHandle};
///
/// async fn nested_subsystem(subsys: SubsystemHandle) -> Result<()> {
/// subsys.on_shutdown_requested().await;
Expand Down Expand Up @@ -189,7 +189,7 @@ impl<ErrType: ErrTypeTraits> SubsystemHandle<ErrType> {
/// return immediately.
///
/// This is the primary method of subsystems to react to
/// the shutdown requests. Most often, it will be used in `tokio::select`
/// the shutdown requests. Most often, it will be used in [`tokio::select`]
/// statements to cancel other code as soon as the shutdown is requested.
///
/// # Examples
Expand All @@ -201,22 +201,22 @@ impl<ErrType: ErrTypeTraits> SubsystemHandle<ErrType> {
///
/// async fn countdown() {
/// for i in (1..10).rev() {
/// log::info!("Countdown: {}", i);
/// tracing::info!("Countdown: {}", i);
/// sleep(Duration::from_millis(1000)).await;
/// }
/// }
///
/// async fn countdown_subsystem(subsys: SubsystemHandle) -> Result<()> {
/// log::info!("Starting countdown ...");
/// tracing::info!("Starting countdown ...");
///
/// // This cancels the countdown as soon as shutdown
/// // mode was entered
/// tokio::select! {
/// _ = subsys.on_shutdown_requested() => {
/// log::info!("Countdown cancelled.");
/// tracing::info!("Countdown cancelled.");
/// },
/// _ = countdown() => {
/// log::info!("Countdown finished.");
/// tracing::info!("Countdown finished.");
/// }
/// };
///
Expand Down Expand Up @@ -246,17 +246,17 @@ impl<ErrType: ErrTypeTraits> SubsystemHandle<ErrType> {
/// tokio::select! {
/// // Execute an action. A dummy `sleep` in this case.
/// _ = sleep(Duration::from_millis(1000)) => {
/// log::info!("Action finished.");
/// tracing::info!("Action finished.");
/// }
/// // Perform a shutdown if requested
/// _ = subsys.on_shutdown_requested() => {
/// log::info!("Action aborted.");
/// tracing::info!("Action aborted.");
/// },
/// }
/// }
///
/// async fn my_subsystem(subsys: SubsystemHandle) -> Result<()> {
/// log::info!("Starting subsystem ...");
/// tracing::info!("Starting subsystem ...");
///
/// // We cannot do a `tokio::select` with `on_shutdown_requested`
/// // here, because a shutdown would cancel the action without giving
Expand All @@ -265,7 +265,7 @@ impl<ErrType: ErrTypeTraits> SubsystemHandle<ErrType> {
/// uncancellable_action(&subsys).await;
/// }
///
/// log::info!("Subsystem stopped.");
/// tracing::info!("Subsystem stopped.");
///
/// Ok(())
/// }
Expand Down

0 comments on commit 4baaf7f

Please sign in to comment.