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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.