Use spawn_local
instead of tokio::spawn
on WebAssembly (#1595)
This commit is contained in:
parent
7f927d77aa
commit
63ba510b09
1 changed files with 5 additions and 1 deletions
|
@ -22,6 +22,10 @@ use std::future::IntoFuture;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
use tokio::spawn;
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
use wasm_bindgen_futures::spawn_local as spawn;
|
||||||
|
|
||||||
/// A specialized `Result` type
|
/// A specialized `Result` type
|
||||||
pub type Result<T> = std::result::Result<T, crate::Error>;
|
pub type Result<T> = std::result::Result<T, crate::Error>;
|
||||||
|
@ -140,7 +144,7 @@ where
|
||||||
{
|
{
|
||||||
fn check_server_version(&self) {
|
fn check_server_version(&self) {
|
||||||
let conn = self.clone();
|
let conn = self.clone();
|
||||||
tokio::spawn(async move {
|
spawn(async move {
|
||||||
let (versions, build_meta) = SUPPORTED_VERSIONS;
|
let (versions, build_meta) = SUPPORTED_VERSIONS;
|
||||||
// invalid version requirements should be caught during development
|
// invalid version requirements should be caught during development
|
||||||
let req = VersionReq::parse(versions).expect("valid supported versions");
|
let req = VersionReq::parse(versions).expect("valid supported versions");
|
||||||
|
|
Loading…
Reference in a new issue