Struct async_shutdown::VitalToken [−][src]
pub struct VitalToken { /* fields omitted */ }
Expand description
Token that triggers a shutdown when it is dropped.
The token can be cloned and sent to different threads and tasks freely. If one of the cloned tokens is dropped, a shutdown is triggered. Even if the the rest of the clones still exist.
Implementations
Wrap a future to cause a shutdown when it completes or is dropped.
This consumes the token to avoid accidentally dropping the token after wrapping a future and instantly causing a shutdown. If you need to keep the token around, you can clone it first:
let future = vital_token.clone().wrap_future(future);
Drop the token without causing a shutdown.
This is equivalent to calling std::mem::forget()
on the token.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for VitalToken
impl Send for VitalToken
impl Sync for VitalToken
impl Unpin for VitalToken
impl UnwindSafe for VitalToken
Blanket Implementations
Mutably borrows from an owned value. Read more