-
Notifications
You must be signed in to change notification settings - Fork 56
Closed
Description
Suggesting we add a blocking::Task, a thin blocking wrapper of Task that's more convenient to use in the blocking code. API:
pub mod blocking {
pub struct Task<T>(crate::Task<T>);
impl<T> Task<T> {
fn cancel(self);
fn detach(self) -> Option<T>;
fn wait(self) -> T;
}
impl<T> Deref for Task<T> {
type Target = crate::Task<T>;
...
}
impl From<crate::Task<T>> for Task<T>;
impl From<Task<T>> for crate::Task<T>;
}For the implementation, we will either want to depend on pollster for its block_on or async-io, which IMO would be a bit of an overkill so if we go for async-io, we probably want to feature gate this.
Metadata
Metadata
Assignees
Labels
No labels