Skip to content

Commit 7ab8a26

Browse files
committed
Require Send for underlying types to fix #1
1 parent c791919 commit 7ab8a26

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub fn time_remaining(timeout_point: std::time::Instant) -> std::time::Duration
178178
/// Creates a future for `job` and runs `job`. The result of `job` will be set as result into the
179179
/// future. The parameter passed to `job` is a function that returns if the future is still waiting
180180
/// so that `job` can check for cancellation.
181-
pub fn async_with_state<T: 'static, U: 'static, F: FnOnce(Future<T, U>) + Send + 'static>(job: F, shared_state: U) -> Future<T, U> {
181+
pub fn async_with_state<T: 'static + Send, U: 'static + Send, F: FnOnce(Future<T, U>) + Send + 'static>(job: F, shared_state: U) -> Future<T, U> {
182182
use std::clone::Clone;
183183

184184
// Create future and spawn job
@@ -192,7 +192,7 @@ pub fn async_with_state<T: 'static, U: 'static, F: FnOnce(Future<T, U>) + Send +
192192
/// Creates a future for `job` and runs `job`. The result of `job` will be set as result into the
193193
/// future. The parameter passed to `job` is a function that returns if the future is still waiting
194194
/// so that `job` can check for cancellation.
195-
pub fn async<T: 'static, F: FnOnce(Future<T, ()>) + Send + 'static>(job: F) -> Future<T, ()> {
195+
pub fn async<T: 'static + Send, F: FnOnce(Future<T, ()>) + Send + 'static>(job: F) -> Future<T, ()> {
196196
async_with_state(job, ())
197197
}
198198

0 commit comments

Comments
 (0)