Skip to content

Commit

Permalink
feat(docs): add doc_cfg for feature-specific items
Browse files Browse the repository at this point in the history
Signed-off-by: vados <[email protected]>
  • Loading branch information
t3hmrman committed Jul 28, 2023
1 parent fb73d2e commit bb32571
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
//! });
//! }
//! ```
//!
//! The example above demonstrates the synchronous usage, but `tokio` and `async-std` and corresponding modules are available as well.
use std::{result::Result, time::Duration};

Expand Down
3 changes: 3 additions & 0 deletions src/runtime/async_std.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![cfg(feature = "async-std")]
#![feature(doc_cfg)]

use std::{error::Error, future::Future, time::Instant};

Expand All @@ -9,6 +10,7 @@ use crate::{AsyncSituwaition, SituwaitionError};

use super::AsyncWaiter;

#[doc(cfg(feature = "async-std"))]
#[async_trait]
impl<F, A, R, E> AsyncSituwaition for AsyncWaiter<F, A, R, E>
where
Expand Down Expand Up @@ -51,6 +53,7 @@ where
///
/// Returning a result (as opposed to the error) will end waiting, otherwise
/// the function will be retried up until the default timeout (see SituwaitionOpts)
#[doc(cfg(feature = "async-std"))]
#[allow(dead_code)]
pub async fn wait_for<R, E, F, G>(factory: F) -> Result<R, SituwaitionError<E>>
where
Expand Down
3 changes: 3 additions & 0 deletions src/runtime/tokio.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![cfg(feature = "tokio")]
#![feature(doc_cfg)]

use std::{error::Error, future::Future};

Expand All @@ -9,6 +10,7 @@ use crate::{AsyncSituwaition, SituwaitionError};

use super::AsyncWaiter;

#[doc(cfg(feature = "tokio"))]
#[async_trait]
impl<F, A, R, E> AsyncSituwaition for AsyncWaiter<F, A, R, E>
where
Expand Down Expand Up @@ -51,6 +53,7 @@ where
///
/// Returning a result (as opposed to the error) will end waiting, otherwise
/// the function will be retried up until the default timeout (see SituwaitionOpts)
#[doc(cfg(feature = "tokio"))]
#[allow(dead_code)]
pub async fn wait_for<R, E, F, G>(factory: F) -> Result<R, SituwaitionError<E>>
where
Expand Down

0 comments on commit bb32571

Please sign in to comment.