pub struct WaitAny<T> { /* private fields */ }Expand description
等待多个交值方中最先被接受的值。
使用 wait_any 构造;完成结果为 RawResult<T, WaitError>。
第一个被接受的值即可完成,不等待其余句柄(handle)释放。
只有全部有效交值方均无值结束且没有胜出者,才返回 WaitError::SenderDropped。
放弃等待停止接收,不等待其它线程;同时只允许一个轮询(poll)者。
完成后再次轮询会恐慌(panic)。不要求 T: Unpin、Sync 或 'static;
跨线程移动仍须满足 T: Send。通知回调异常后不保证可继续轮询,仍可安全放弃。
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for WaitAny<T>
impl<T> !UnwindSafe for WaitAny<T>
impl<T> Forget for WaitAny<T>
impl<T> Freeze for WaitAny<T>
impl<T> Move for WaitAny<T>
impl<T> Send for WaitAny<T>
impl<T> Sync for WaitAny<T>
impl<T> Unpin for WaitAny<T>
impl<T> UnsafeUnpin for WaitAny<T>
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<Fut> FutureExt for Fut
impl<Fut> FutureExt for Fut
Source§fn attach<A>(self, attachment: A) -> FutureWithAttachment<Fut, A> ⓘwhere
A: Attachment,
fn attach<A>(self, attachment: A) -> FutureWithAttachment<Fut, A> ⓘwhere
A: Attachment,
Source§fn attach_with<A, F>(self, attachment: F) -> FutureWithLazyAttachment<Fut, F> ⓘwhere
A: Attachment,
F: FnOnce() -> A,
fn attach_with<A, F>(self, attachment: F) -> FutureWithLazyAttachment<Fut, F> ⓘwhere
A: Attachment,
F: FnOnce() -> A,
Source§fn attach_opaque<A>(self, attachment: A) -> FutureWithOpaqueAttachment<Fut, A> ⓘwhere
A: OpaqueAttachment,
fn attach_opaque<A>(self, attachment: A) -> FutureWithOpaqueAttachment<Fut, A> ⓘwhere
A: OpaqueAttachment,
Source§fn attach_opaque_with<A, F>(
self,
attachment: F,
) -> FutureWithLazyOpaqueAttachment<Fut, F> ⓘwhere
A: OpaqueAttachment,
F: FnOnce() -> A,
fn attach_opaque_with<A, F>(
self,
attachment: F,
) -> FutureWithLazyOpaqueAttachment<Fut, F> ⓘwhere
A: OpaqueAttachment,
F: FnOnce() -> A,
Source§fn change_context<C>(self, context: C) -> FutureWithContext<Fut, C> ⓘ
fn change_context<C>(self, context: C) -> FutureWithContext<Fut, C> ⓘ
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more