Skip to content

Commit 9af8a7c

Browse files
committed
Conditionally compile for WASM support
1 parent 2fe6e64 commit 9af8a7c

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

sdk/core/src/pipeline.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use crate::policies::{Policy, PolicyResult, TelemetryPolicy, TransportPolicy};
1+
#[cfg(not(target_arch = "wasm32"))]
2+
use crate::policies::TransportPolicy;
3+
use crate::policies::{Policy, PolicyResult, TelemetryPolicy};
24
use crate::{ClientOptions, Context, Request, Response};
35
use std::sync::Arc;
46

@@ -59,8 +61,12 @@ impl Pipeline {
5961
pipeline.extend_from_slice(&per_retry_policies);
6062
pipeline.extend_from_slice(&options.per_retry_policies);
6163

62-
let transport_policy = TransportPolicy::new(&options.transport);
63-
pipeline.push(Arc::new(transport_policy));
64+
// TODO: Add transport policy for WASM once https://github.com/Azure/azure-sdk-for-rust/issues/293 is resolved.
65+
#[cfg(not(target_arch = "wasm32"))]
66+
{
67+
let transport_policy = TransportPolicy::new(&options.transport);
68+
pipeline.push(Arc::new(transport_policy));
69+
}
6470

6571
Self { pipeline }
6672
}

sdk/core/src/policies/transport.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[cfg(not(target_arch = "wasm32"))]
12
use crate::policies::{Policy, PolicyResult};
23
#[allow(unused_imports)]
34
use crate::TransportOptions;
@@ -11,6 +12,7 @@ pub struct TransportPolicy {
1112
}
1213

1314
impl TransportPolicy {
15+
#[cfg(not(target_arch = "wasm32"))]
1416
pub fn new(options: &TransportOptions) -> Self {
1517
Self {
1618
http_client: options.http_client.clone(),

0 commit comments

Comments
 (0)