Skip to main content

Module stream

Module stream 

Source
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 .await points even when the executor moves it between worker threads.
  • [Stream] gives manual control: Stream::spawn, Stream::enter and Stream::attach pin work to an explicit stream in any environment.

Structs§

Stream
A manually managed stream identity.
StreamFuture
A future bound to a Stream, created with Stream::attach.
StreamId
Unique identifier representing the stream on which work is submitted.
StreamJoinHandlemulti_threading
Handle to a thread spawned with Stream::spawn.

Enums§

StreamPolicy
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.