Skip to main content

Crate go

Crate go 

Source
Expand description

§go

A runtime-agnostic Go-style concurrency library for Rust.

Select your async runtime at compile time via Cargo features:

[dependencies]
go = { version = "0.1", features = ["rt-tokio"] }   # or rt-async-std, rt-smol

§Primitives

Modules§

chan
singleflight
Deduplicate concurrent calls keyed by an arbitrary key.

Macros§

go
Spawn an async task (Go-style). Returns a JoinHandle<T>.
select
select! macro that multiplexes multiple channel recv operations.

Structs§

Elapsed
Error returned when a timeout expires.
JoinHandle
A handle to a spawned task. Dropping it detaches the task (fire-and-forget).
WaitGroup
A synchronization primitive that waits for a group of tasks to complete.
WaitGroupGuard
A guard that calls WaitGroup::done() when dropped.

Enums§

JoinError
Error returned when a spawned task fails.

Functions§

sleep
Sleep for the given duration.
spawn
Spawn an async task, returning a handle that can be awaited for the result.
timeout
Run a future with a timeout. Returns Err(Elapsed) if the deadline passes before the future completes.