Skip to content

Commit 9a93c4d

Browse files
committed
exclude everything which can not be compiled for web-assmembly code
1 parent fe571d0 commit 9a93c4d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/async_client.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
#[cfg(not(target_arch = "wasm32"))]
12
use futures::future::BoxFuture;
3+
#[cfg(not(target_arch = "wasm32"))]
24
use futures::prelude::*;
35
use futures::{future::try_join_all, try_join};
46
use reqwest::{header, Client as HttpClient, StatusCode, Url};
57
use serde::de::DeserializeOwned;
68

9+
#[cfg(not(target_arch = "wasm32"))]
710
use std::collections::VecDeque;
811

912
use web_time::Duration;
@@ -22,6 +25,7 @@ pub struct Client {
2225
base_url: Url,
2326
}
2427

28+
#[cfg(not(target_arch = "wasm32"))]
2529
pub struct CrateStream {
2630
client: Client,
2731
filter: CratesQuery,
@@ -31,6 +35,7 @@ pub struct CrateStream {
3135
next_page_fetch: Option<BoxFuture<'static, Result<CratesPage, Error>>>,
3236
}
3337

38+
#[cfg(not(target_arch = "wasm32"))]
3439
impl CrateStream {
3540
fn new(client: Client, filter: CratesQuery) -> Self {
3641
Self {
@@ -43,6 +48,7 @@ impl CrateStream {
4348
}
4449
}
4550

51+
#[cfg(not(target_arch = "wasm32"))]
4652
impl futures::stream::Stream for CrateStream {
4753
type Item = Result<Crate, Error>;
4854

@@ -384,6 +390,7 @@ impl Client {
384390
}
385391

386392
/// Get a stream over all crates matching the given [`CratesQuery`].
393+
#[cfg(not(target_arch = "wasm32"))]
387394
pub fn crates_stream(&self, filter: CratesQuery) -> CrateStream {
388395
CrateStream::new(self.clone(), filter)
389396
}

src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,16 @@
4646

4747
mod async_client;
4848
mod error;
49+
#[cfg(not(target_arch = "wasm32"))]
4950
mod sync_client;
5051
mod types;
5152
mod util;
5253

5354
pub use crate::{
5455
async_client::Client as AsyncClient,
5556
error::{Error, NotFoundError, PermissionDeniedError},
56-
sync_client::SyncClient,
5757
types::*,
5858
};
59+
60+
#[cfg(not(target_arch = "wasm32"))]
61+
pub use crate::sync_client::SyncClient;

0 commit comments

Comments
 (0)