Crate futures_scopes
source ·Expand description
An extension to futures-rs that offers scopes. Scopes can be used to spawn non-static futures that can reference variables on the stack that were created before the scope was created.
There are currently two different Scope types:
- For spawning local non-send/sync futures, use
LocalScope
. - For spawning futures on multiple, underlying spawns, use
RelayScope
.
Features
The following features are available on the crate:
local
: EnablesLocalScope
.relay
: EnablesRelayScope
.
By default both features are enabled. To only use one of the features, disable the default features and enable the feature you want to use. For example:
[dependencies]
futures-scopes = {version = "...", default-features = false, features = ["local"]}
Modules
- Provides
LocalScope
, which can spawn non-send/sync futures of non-static lifetime. - Provides
RelayScope
, which can spawn send/sync futures of non-static lifetime.
Traits
- A scope that can spawn non-static futures
- Extension trait for
ScopedSpawn
. - A trait for scopes that support spawning futures of non-static lifetime.