-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Separate Yew Platform #2893
Separate Yew Platform #2893
Changes from 5 commits
6992ada
ae41979
efb5ae4
e6c7e1e
7c91aff
eac2f19
f62a737
95509cc
9b03269
680590b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
[package] | ||
name = "yew-platform" | ||
version = "0.1.0" | ||
authors = ["Kaede Hoshikawa <futursolo@icloud.com>"] | ||
edition = "2021" | ||
license = "MIT OR Apache-2.0" | ||
readme = "README.md" | ||
keywords = ["yew", "futures", "async", "io"] | ||
categories = ["asynchronous"] | ||
description = "Yew's asynchronous runtime." | ||
repository = "https://github.com/yewstack/yew" | ||
rust-version = "1.60.0" | ||
|
||
[dependencies] | ||
futures = { version = "0.3", default-features = false, features = ["std", "async-await"] } | ||
pin-project = "1.0.11" | ||
pinned = "0.1.0" | ||
|
||
[target.'cfg(target_arch = "wasm32")'.dependencies] | ||
# we move wasm-bindgen here so no promise-based spawn_local can present for | ||
# non-wasm32 targets. | ||
wasm-bindgen-futures = "0.4" | ||
gloo = "0.8" | ||
|
||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] | ||
num_cpus = { version = "1.13", optional = true } | ||
once_cell = "1" | ||
tokio = { version = "1.21.1", features = ["rt", "time"], optional = true } | ||
tokio-stream = { version = "0.1", features = ["time"], optional = true } | ||
|
||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] | ||
tokio = { version = "1.19", features = ["full"] } | ||
|
||
[features] | ||
tokio = ["dep:tokio", "dep:num_cpus", "dep:tokio-stream"] | ||
default = [] | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
rustdoc-args = ["--cfg", "documenting"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# yew-platform | ||
|
||
Runtime for the [Yew](https://github.com/yewstack/yew) framework. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//! Task synchronisation primitives for pinned tasks. | ||
//! | ||
//! This module provides the following task synchronisation mechanisms for `!Send` futures: | ||
futursolo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
//! | ||
//! - [`Barrier`]: Ensures multiple tasks to wait until all tasks have reached a point in the | ||
//! program before continuing execution of all together. | ||
//! - [`RwLock`]: Provides a mutual exclusion mechanism which allows multiple readers at the same | ||
//! time, while allowing only one writer at a time. | ||
//! - [`mpsc`]: A channel that supports sending multiple values from multiple producers to a single | ||
//! receiver. | ||
//! - [`oneshot`]: A channel to send one single value from a producer to a receiver. | ||
|
||
#[doc(inline)] | ||
pub use pinned::*; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,14 +25,21 @@ slab = "0.4" | |
wasm-bindgen = "0.2" | ||
yew-macro = { version = "^0.19.0", path = "../yew-macro" } | ||
thiserror = "1.0" | ||
futures = { version = "0.3", default-features = false, features = ["std", "async-await"] } | ||
futures = { version = "0.3", default-features = false, features = ["std"] } | ||
html-escape = { version = "0.2.9", optional = true } | ||
implicit-clone = { version = "0.3", features = ["map"] } | ||
base64ct = { version = "1.5.0", features = ["std"], optional = true } | ||
bincode = { version = "1.3.3", optional = true } | ||
serde = { version = "1", features = ["derive"] } | ||
tracing = "0.1.36" | ||
pin-project = "1.0.11" | ||
yew-platform = { version = "0.1.0", path = "../yew-platform" } | ||
|
||
[target.'cfg(target_arch = "wasm32")'.dependencies] | ||
wasm-bindgen-futures = "0.4" | ||
Comment on lines
+38
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we still need a direct dependency on this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is due to yew is using wasm_bindgen_futures::JsFuture in a couple places. |
||
|
||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] | ||
# We still need tokio as we have docs linked to it. | ||
tokio = { version = "1.19", features = ["rt"] } | ||
|
||
[dependencies.web-sys] | ||
version = "^0.3.59" | ||
|
@@ -69,21 +76,12 @@ features = [ | |
"SubmitEvent" | ||
] | ||
|
||
[target.'cfg(target_arch = "wasm32")'.dependencies] | ||
# we move it here so no promise-based spawn_local can present for | ||
# non-wasm32 targets. | ||
wasm-bindgen-futures = "0.4" | ||
|
||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] | ||
num_cpus = { version = "1.13", optional = true } | ||
once_cell = "1" | ||
tokio = { version = "1.21.1", features = ["rt", "time"], optional = true } | ||
tokio-stream = { version = "0.1", features = ["time"], optional = true } | ||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] | ||
tokio = { version = "1.19", features = ["full"] } | ||
|
||
[dev-dependencies] | ||
wasm-bindgen-test = "0.3" | ||
gloo = { version = "0.8", features = ["futures"] } | ||
wasm-bindgen-futures = "0.4" | ||
rustversion = "1" | ||
trybuild = "1" | ||
|
||
|
@@ -95,15 +93,12 @@ features = [ | |
] | ||
|
||
[features] | ||
tokio = ["dep:tokio", "dep:num_cpus", "dep:tokio-stream"] | ||
tokio = ["yew-platform/tokio"] | ||
ssr = ["dep:html-escape", "dep:base64ct", "dep:bincode"] | ||
csr = [] | ||
hydration = ["csr", "dep:bincode"] | ||
default = [] | ||
|
||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] | ||
tokio = { version = "1.19", features = ["full"] } | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
rustdoc-args = ["--cfg", "documenting"] |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we dropped the
yew-
prefix from here? It can be generic crate that can be used to pick an async runtime between tokio and wasm-bindgen-futures (JS promises)Name idea: promise + tokio = prokio
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I have published the crate under name
prokio
.