Skip to content

Commit

Permalink
util: improve impl Send for ReusableBoxFuture docs (#4658)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn committed May 7, 2022
1 parent 1872a42 commit 938b7d6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tokio-util/src/sync/reusable_box.rs
Expand Up @@ -122,7 +122,12 @@ impl<T> Future for ReusableBoxFuture<'_, T> {
}
}

// The future stored inside ReusableBoxFuture<'_, T> must be Send.
// The future stored inside ReusableBoxFuture<'_, T> must be Send since the
// `new` and `set` and `try_set` methods only allow setting the future to Send
// futures.
//
// Note that T is the return type of the future, so its not relevant for
// whether the future itself is Send.
unsafe impl<T> Send for ReusableBoxFuture<'_, T> {}

// The only method called on self.boxed is poll, which takes &mut self, so this
Expand Down

0 comments on commit 938b7d6

Please sign in to comment.