Trait CancelObserver
pub trait CancelObserver:
Send
+ Sync
+ 'static {
// Required methods
fn complete(&self, outcome: CancellationOutcome);
fn abandon(&self);
}Expand description
完成或放弃取消等待(cancellation wait)登记的外部窄接口。
实现者先移除实际等待关系,再发布结果并通知;不得回返访问原异步计算(Future)。
Required Methods§
fn complete(&self, outcome: CancellationOutcome)
fn complete(&self, outcome: CancellationOutcome)
结果只发布一次;失败不得冒充原值清理已成功。
fn abandon(&self)
fn abandon(&self)
移除本份登记和通知责任;不撤销此前合法取消请求(cancellation request)。
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".