| { | ||
| "git": { | ||
| "sha1": "753bb7ff4de2a00e30d2c6b56ee8e06a9e527f01" | ||
| "sha1": "3c5043f94d85c7df1b25195ab005814ba001a93b" | ||
| }, | ||
| "path_in_vcs": "crates/js-sys" | ||
| } |
+9
-9
@@ -79,3 +79,3 @@ # This file is automatically @generated by Cargo. | ||
| name = "js-sys" | ||
| version = "0.3.95" | ||
| version = "0.3.97" | ||
| dependencies = [ | ||
@@ -153,5 +153,5 @@ "cfg-if", | ||
| name = "wasm-bindgen" | ||
| version = "0.2.118" | ||
| version = "0.2.120" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89" | ||
| checksum = "df52b6d9b87e0c74c9edfa1eb2d9bf85e5d63515474513aa50fa181b3c4f5db1" | ||
| dependencies = [ | ||
@@ -167,5 +167,5 @@ "cfg-if", | ||
| name = "wasm-bindgen-macro" | ||
| version = "0.2.118" | ||
| version = "0.2.120" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed" | ||
| checksum = "78b1041f495fb322e64aca85f5756b2172e35cd459376e67f2a6c9dffcedb103" | ||
| dependencies = [ | ||
@@ -178,5 +178,5 @@ "quote", | ||
| name = "wasm-bindgen-macro-support" | ||
| version = "0.2.118" | ||
| version = "0.2.120" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904" | ||
| checksum = "9dcd0ff20416988a18ac686d4d4d0f6aae9ebf08a389ff5d29012b05af2a1b41" | ||
| dependencies = [ | ||
@@ -192,5 +192,5 @@ "bumpalo", | ||
| name = "wasm-bindgen-shared" | ||
| version = "0.2.118" | ||
| version = "0.2.120" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129" | ||
| checksum = "49757b3c82ebf16c57d69365a142940b384176c24df52a087fb748e2085359ea" | ||
| dependencies = [ | ||
@@ -197,0 +197,0 @@ "unicode-ident", |
+7
-9
@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| name = "js-sys" | ||
| version = "0.3.95" | ||
| version = "0.3.97" | ||
| authors = ["The wasm-bindgen Developers"] | ||
@@ -45,11 +45,10 @@ build = false | ||
| ] | ||
| futures = [ | ||
| "dep:cfg-if", | ||
| futures-core-03-stream = [ | ||
| "dep:futures-util", | ||
| ] | ||
| futures-core-03-stream = [ | ||
| "futures", | ||
| "dep:futures-core", | ||
| ] | ||
| std = ["wasm-bindgen/std"] | ||
| std = [ | ||
| "wasm-bindgen/std", | ||
| "dep:futures-util", | ||
| ] | ||
| unsafe-eval = [] | ||
@@ -65,3 +64,2 @@ | ||
| version = "1.0.0" | ||
| optional = true | ||
@@ -84,3 +82,3 @@ [dependencies.futures-core] | ||
| [dependencies.wasm-bindgen] | ||
| version = "=0.2.118" | ||
| version = "=0.2.120" | ||
| default-features = false | ||
@@ -87,0 +85,0 @@ |
+17
-15
@@ -43,8 +43,9 @@ //! Converting between JavaScript `Promise`s to Rust `Future`s. | ||
| use core::task::{Context, Poll, Waker}; | ||
| #[cfg(all(target_arch = "wasm32", feature = "std", panic = "unwind"))] | ||
| #[cfg(all(target_family = "wasm", feature = "std", panic = "unwind"))] | ||
| use futures_util::FutureExt; | ||
| use wasm_bindgen::__rt::marker::ErasableGeneric; | ||
| #[cfg(all(target_arch = "wasm32", feature = "std", panic = "unwind"))] | ||
| #[cfg(all(target_family = "wasm", feature = "std", panic = "unwind"))] | ||
| use wasm_bindgen::__rt::panic_to_panic_error; | ||
| use wasm_bindgen::convert::{FromWasmAbi, Upcast}; | ||
| use wasm_bindgen::sys::Promising; | ||
| use wasm_bindgen::{prelude::*, JsError, JsGeneric}; | ||
@@ -130,3 +131,3 @@ | ||
| impl<T: 'static + FromWasmAbi> From<Promise<T>> for JsFuture<T> { | ||
| impl<T: JsGeneric + FromWasmAbi> From<Promise<T>> for JsFuture<T> { | ||
| fn from(js: Promise<T>) -> JsFuture<T> { | ||
@@ -221,3 +222,3 @@ // Use the `then` method to schedule two callbacks, one for the | ||
| impl<T: 'static + FromWasmAbi> IntoFuture for Promise<T> { | ||
| impl<T: JsGeneric + FromWasmAbi> IntoFuture for Promise<T> { | ||
| type Output = Result<T, JsValue>; | ||
@@ -247,3 +248,3 @@ type IntoFuture = JsFuture<T>; | ||
| /// still usable (likely erroneously) after Rust panics. | ||
| #[cfg(not(all(target_arch = "wasm32", feature = "std", panic = "unwind")))] | ||
| #[cfg(not(all(target_family = "wasm", feature = "std", panic = "unwind")))] | ||
| pub fn future_to_promise<F>(future: F) -> Promise | ||
@@ -261,6 +262,6 @@ where | ||
| Ok(val) => { | ||
| resolve.call(&JsValue::undefined(), (&val,)).unwrap_throw(); | ||
| resolve.call(&JsValue::UNDEFINED, (&val,)).unwrap_throw(); | ||
| } | ||
| Err(val) => { | ||
| reject.call(&JsValue::undefined(), (&val,)).unwrap_throw(); | ||
| reject.call(&JsValue::UNDEFINED, (&val,)).unwrap_throw(); | ||
| } | ||
@@ -287,3 +288,3 @@ } | ||
| /// with a PanicError. | ||
| #[cfg(all(target_arch = "wasm32", feature = "std", panic = "unwind"))] | ||
| #[cfg(all(target_family = "wasm", feature = "std", panic = "unwind"))] | ||
| pub fn future_to_promise<F>(future: F) -> Promise | ||
@@ -304,10 +305,10 @@ where | ||
| Ok(Ok(val)) => { | ||
| resolve.call(&JsValue::undefined(), (&val,)).unwrap_throw(); | ||
| resolve.call(&JsValue::UNDEFINED, (&val,)).unwrap_throw(); | ||
| } | ||
| Ok(Err(val)) => { | ||
| reject.call(&JsValue::undefined(), (&val,)).unwrap_throw(); | ||
| reject.call(&JsValue::UNDEFINED, (&val,)).unwrap_throw(); | ||
| } | ||
| Err(val) => { | ||
| reject | ||
| .call(&JsValue::undefined(), (&panic_to_panic_error(val),)) | ||
| .call(&JsValue::UNDEFINED, (&panic_to_panic_error(val),)) | ||
| .unwrap_throw(); | ||
@@ -341,6 +342,7 @@ } | ||
| /// limitation of Wasm currently that's hoped to be fixed one day! | ||
| pub fn future_to_promise_typed<F, T>(future: F) -> Promise<T> | ||
| pub fn future_to_promise_typed<T, F>(future: F) -> Promise<<T as Promising>::Resolution> | ||
| where | ||
| F: Future<Output = Result<T, JsValue>> + 'static, | ||
| T: FromWasmAbi + JsGeneric + Upcast<T> + 'static, | ||
| T: Promising + FromWasmAbi + JsGeneric, | ||
| <T as Promising>::Resolution: JsGeneric, | ||
| { | ||
@@ -354,6 +356,6 @@ let mut future = Some(future); | ||
| Ok(val) => { | ||
| resolve.call(&JsValue::undefined(), (&val,)).unwrap_throw(); | ||
| resolve.call(&JsValue::UNDEFINED, (&val,)).unwrap_throw(); | ||
| } | ||
| Err(val) => { | ||
| reject.call(&JsValue::undefined(), (&val,)).unwrap_throw(); | ||
| reject.call(&JsValue::UNDEFINED, (&val,)).unwrap_throw(); | ||
| } | ||
@@ -360,0 +362,0 @@ } |
@@ -24,3 +24,3 @@ //! Converting JavaScript `AsyncIterator`s to Rust `Stream`s. | ||
| impl<T: 'static + FromWasmAbi> JsStream<T> { | ||
| impl<T: JsGeneric + FromWasmAbi> JsStream<T> { | ||
| fn next_future(&self) -> Result<JsFuture<IteratorNext<T>>, JsValue> { | ||
@@ -41,3 +41,3 @@ self.iter.next_iterator().map(JsFuture::from) | ||
| impl<T: 'static + JsGeneric + FromWasmAbi + Unpin> Stream for JsStream<T> { | ||
| impl<T: JsGeneric + FromWasmAbi + Unpin> Stream for JsStream<T> { | ||
| type Item = Result<T, JsValue>; | ||
@@ -44,0 +44,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display