Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ bevy = { version = "0.17.2", default-features = false, features = [

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
futures-timer = "3.0.3"
async-compat = "0.2.5"

[target.'cfg(target_arch = "wasm32")'.dependencies]
futures-timer = { version = "3.0.3", features = ["wasm-bindgen"] }
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

[![Discord](https://img.shields.io/discord/913957940560531456.svg?label=Loopy&logo=discord&logoColor=ffffff&color=ffffff&labelColor=000000)](https://discord.gg/zrjnQzdjCB)
![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)
[![Build status](https://github.com/loopystudios/bevy_async_task/workflows/CI/badge.svg)](https://github.com/loopystudios/bevy_async_task/actions)
[![Following released Bevy versions](https://img.shields.io/badge/bevy%20tracking-released%20version-lightblue)](https://bevyengine.org/learn/quick-start/plugin-development/#main-branch-tracking)\
[![Dependency status](https://deps.rs/repo/github/loopystudios/bevy_async_task/status.svg)](https://deps.rs/repo/github/loopystudios/bevy_async_task)
[![crates.io](https://img.shields.io/crates/v/bevy_async_task.svg)](https://crates.io/crates/bevy_async_task)
[![docs.rs](https://img.shields.io/docsrs/bevy_async_task)](https://docs.rs/bevy_async_task)
[![Build status](https://github.com/loopystudios/bevy_async_task/workflows/CI/badge.svg)](https://github.com/loopystudios/bevy_async_task/actions)

A minimum crate for ergonomic abstractions to async programming in Bevy. There is full API support for **wasm** and **native**. Android and iOS are untested (Help needed).

Expand Down
8 changes: 0 additions & 8 deletions src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use std::task::Poll;

#[cfg(not(target_arch = "wasm32"))]
use async_compat::CompatExt;
use bevy_tasks::ConditionalSend;
use bevy_tasks::ConditionalSendFuture;
use futures::task::AtomicWaker;
Expand Down Expand Up @@ -93,10 +91,7 @@ where
let waker = waker.clone();
let received = received.clone();
async move {
#[cfg(target_arch = "wasm32")]
let result = self.fut.await;
#[cfg(not(target_arch = "wasm32"))]
let result = self.fut.compat().await;

if let Ok(()) = tx.send(result) {
// Wait for the receiver to get the result before dropping.
Expand Down Expand Up @@ -193,10 +188,7 @@ where
let waker = waker.clone();
let received = received.clone();
async move {
#[cfg(target_arch = "wasm32")]
let result = timeout(self.timeout, self.fut).await;
#[cfg(not(target_arch = "wasm32"))]
let result = timeout(self.timeout, self.fut.compat()).await;

if let Ok(()) = tx.send(result) {
// Wait for the receiver to get the result before dropping.
Expand Down