Skip to content

Commit

Permalink
feat: relax constraints to match target
Browse files Browse the repository at this point in the history
Match constraints of the method being called.
Was not working in WASM with constraints and they are needed.
  • Loading branch information
c-git committed Jul 16, 2024
1 parent 532243e commit 1659339
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/wrappers.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! Stores the wrapper functions that can be called from either native or wasm
//! code
use futures::Future;

/// Performs a HTTP requests and calls the given callback when done. NB: Needs
/// to use a callback to prevent blocking on the thread that initiates the
/// fetch. Note: Instead of calling get like in the example you can use post,
Expand Down Expand Up @@ -45,11 +47,7 @@ where

/// Provides a cross platform compatible way to run an async function in a blocking fashion.
/// Intended for use in callbacks as this will block but call backs are not async so we need sync code
pub fn block_on<F>(future: F) -> F::Output
where
F: std::future::Future + Send + 'static,
F::Output: Send + 'static,
{
pub fn block_on<F: Future>(future: F) -> F::Output {
futures::executor::block_on(future)
}

Expand Down

0 comments on commit 1659339

Please sign in to comment.