Skip to content

Commit c021a59

Browse files
committed
add notes for docsrs to clarify what is not available when compiling for WASM
1 parent 9a93c4d commit c021a59

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/async_client.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub struct Client {
2626
}
2727

2828
#[cfg(not(target_arch = "wasm32"))]
29+
#[cfg_attr(docsrs, doc(cfg(not(target_arch = "wasm32"))))]
2930
pub struct CrateStream {
3031
client: Client,
3132
filter: CratesQuery,
@@ -36,6 +37,7 @@ pub struct CrateStream {
3637
}
3738

3839
#[cfg(not(target_arch = "wasm32"))]
40+
#[cfg_attr(docsrs, doc(cfg(not(target_arch = "wasm32"))))]
3941
impl CrateStream {
4042
fn new(client: Client, filter: CratesQuery) -> Self {
4143
Self {
@@ -49,6 +51,7 @@ impl CrateStream {
4951
}
5052

5153
#[cfg(not(target_arch = "wasm32"))]
54+
#[cfg_attr(docsrs, doc(cfg(not(target_arch = "wasm32"))))]
5255
impl futures::stream::Stream for CrateStream {
5356
type Item = Result<Crate, Error>;
5457

@@ -391,6 +394,7 @@ impl Client {
391394

392395
/// Get a stream over all crates matching the given [`CratesQuery`].
393396
#[cfg(not(target_arch = "wasm32"))]
397+
#[cfg_attr(docsrs, doc(cfg(not(target_arch = "wasm32"))))]
394398
pub fn crates_stream(&self, filter: CratesQuery) -> CrateStream {
395399
CrateStream::new(self.clone(), filter)
396400
}

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@
4343
4444
#![recursion_limit = "128"]
4545
#![deny(missing_docs)]
46+
#![cfg_attr(docsrs, feature(doc_cfg))]
4647

4748
mod async_client;
4849
mod error;
4950
#[cfg(not(target_arch = "wasm32"))]
51+
#[cfg_attr(docsrs, doc(cfg(not(target_arch = "wasm32"))))]
5052
mod sync_client;
5153
mod types;
5254
mod util;
@@ -58,4 +60,5 @@ pub use crate::{
5860
};
5961

6062
#[cfg(not(target_arch = "wasm32"))]
63+
#[cfg_attr(docsrs, doc(cfg(not(target_arch = "wasm32"))))]
6164
pub use crate::sync_client::SyncClient;

0 commit comments

Comments
 (0)