Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm32 target support (v2) #1367

Merged
merged 7 commits into from
Sep 12, 2023
Merged

wasm32 target support (v2) #1367

merged 7 commits into from
Sep 12, 2023

Conversation

johnbatty
Copy link
Contributor

@johnbatty johnbatty commented Sep 11, 2023

This PR replaces my earlier draft wasm PR: #1128

The main changes are as follows.

azure_core

  • enable inclusion of reqwest and creation of a reqwest http client in the http_client module when the target is wasm32
  • for wasm32 target omit the Send trait when using async_trait by specifying async_trait(?Send)
  • use newly added reqwest support (0.11.14) for wasm implementation of Response::bytes_stream()
  • for wasm32 target remove support for Body::SeekableStream
    • this currently can't be implemented as reqwest::Body::wrap_stream() is not implemented for WASM
    • I think we should accept this as a wasm32 limitation for now
  • for wasm32 target remove Send + Sync from the PinnedStream definition
  • add a new feature wasm-bindgen that enables time/wasm-bindgen to allow the UTC time to be queried via the browser API
    • if this time feature is not enabled then the retry policy code triggers a panic when querying the current time

autorust

Update autorust to use LocalBoxFuture for wasm32 target rather than BoxFuture

Autogenerated services

Regenerate with modified autorust

sdk/core/Cargo.toml Outdated Show resolved Hide resolved
Copy link
Member

@cataggar cataggar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

time = { version = "0.3.10", features = ["serde-well-known", "macros", "local-offset"] }

# When target is `wasm32`, include `getrandom` and enable `wasm-bindgen` feature in `time`.
[target.'cfg(target_arch = "wasm32")'.dependencies]
time = { version = "0.3.10", features = ["serde-well-known", "macros", "local-offset", "wasm-bindgen"] }
time = { version = "0.3.10", features = ["wasm-bindgen"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is easier to read.

@demoray demoray merged commit f978185 into Azure:main Sep 12, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants