pub struct Timeout<A: TimerAccess> { /* private fields */ }Expand description
正时长首次poll才固定截止时间并登记;零时长只让出一次。 正常到期返回Ok(());已登记项实际因取消结束才返回TimerError::Cancelled,其它未到期移除返回RegistrationRemoved。 单纯记录取消请求不表示等待结束;尚未开始登记的取消可本地结束,原准备错误仍原样返回。 正时长至少1ms且不设1s上限;构造错误保存到首次轮询(poll),尚未开始的取消可不入队结束。 零时长首次轮询让出一次并安排再唤醒,后续轮询成功;无计时登记,控制取消返回false。 完成后再轮询会恐慌(panic);释放(drop)结束兴趣并安排撤销,不等待原截止时间。
Implementations§
§impl<A: TimerAccess> Timeout<A>
impl<A: TimerAccess> Timeout<A>
pub fn control_handle(&self) -> TimeoutControl<A>
pub fn control_handle(&self) -> TimeoutControl<A>
按需取得同一登记的共享控制;失败准备或零时长所得控制取消返回false。
Trait Implementations§
§impl<A: TimerAccess> Drop for Timeout<A>
impl<A: TimerAccess> Drop for Timeout<A>
§impl<A: TimerAccess> Future for Timeout<A>
impl<A: TimerAccess> Future for Timeout<A>
impl<A: TimerAccess> Unpin for Timeout<A>
Auto Trait Implementations§
impl<A> !RefUnwindSafe for Timeout<A>
impl<A> !UnwindSafe for Timeout<A>
impl<A> Forget for Timeout<A>
impl<A> Freeze for Timeout<A>
impl<A> Move for Timeout<A>
impl<A> Send for Timeout<A>
impl<A> Sync for Timeout<A>
impl<A> UnsafeUnpin for Timeout<A>
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