Expand description
Stream identity, policies and manual stream management. Stream identity, policies and manual stream management.
A stream is a logical submission queue: work on one stream executes in order, work on different streams may overlap. This module owns how the current stream is derived:
- By default, every OS thread gets its own stream ([
StreamPolicy::PerThread]). - Under tokio, [
StreamPolicy::PerTask] keeps a task’s stream stable across.awaitpoints even when the executor moves it between worker threads. - [
Stream] gives manual control:Stream::spawn,Stream::enterandStream::attachpin work to an explicit stream in any environment.
Structs§
- Stream
- A manually managed stream identity.
- Stream
Future - A future bound to a
Stream, created withStream::attach. - Stream
Id - Unique identifier representing the stream on which work is submitted.
- Stream
Join Handle multi_threading - Handle to a thread spawned with
Stream::spawn.
Enums§
- Stream
Policy - How the current stream is derived when no explicit override is active.
Functions§
- policy
- Returns the active stream policy.
- set_
policy - Sets the active stream policy.
- spawn_
detached - Spawns a detached future bound to a fresh stream.