pub struct SpawnedTask<R> { /* private fields */ }
Expand description
Helper that provides a simple API to spawn a single task and join it.
Provides guarantees of aborting on Drop
to keep it cancel-safe.
Technically, it’s just a wrapper of JoinSet
(with size=1).
Implementations§
Source§impl<R> SpawnedTask<R>where
R: 'static,
impl<R> SpawnedTask<R>where
R: 'static,
pub fn spawn<T>(task: T) -> SpawnedTask<R>
Available on crate feature
parquet
only.pub fn spawn_blocking<T>(task: T) -> SpawnedTask<R>
Available on crate feature
parquet
only.Sourcepub async fn join(self) -> Result<R, JoinError>
Available on crate feature parquet
only.
pub async fn join(self) -> Result<R, JoinError>
parquet
only.Joins the task, returning the result of join (Result<R, JoinError>
).
Sourcepub async fn join_unwind(self) -> Result<R, JoinError>
Available on crate feature parquet
only.
pub async fn join_unwind(self) -> Result<R, JoinError>
parquet
only.Joins the task and unwinds the panic if it happens.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for SpawnedTask<R>
impl<R> RefUnwindSafe for SpawnedTask<R>
impl<R> Send for SpawnedTask<R>where
R: Send,
impl<R> Sync for SpawnedTask<R>where
R: Send,
impl<R> Unpin for SpawnedTask<R>
impl<R> UnwindSafe for SpawnedTask<R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more