Cargo Features
Tokio has no features set by default.
[dependencies]
tokio = { version = "1.32.0", features = ["full", "fs", "io-util", "io-std", "macros", "net", "process", "rt", "rt-multi-thread", "signal", "time", "test-util", "stats", "mio", "tracing", "windows-sys"] }
- default
-
Include nothing by default
- full = fs, io-std, io-util, macros, net, parking_lot, process, rt, rt-multi-thread, signal, sync, time
-
enable everything
- fs full?
- io-util full? = bytes
- io-std full?
-
stdin, stdout, stderr
- macros full? = tokio-macros
- net full? = libc, socket2
-
Enables os-poll, os-ext and net of mio, Win32_Foundation, Win32_Security, Win32_Storage_FileSystem, Win32_System_Pipes and Win32_System_SystemServices of windows-sys
- process full? = bytes, libc, signal-hook-registry
-
Enables os-poll, os-ext and net of mio, Win32_Foundation, Win32_System_Threading and Win32_System_WindowsProgramming of windows-sys
- rt full? rt-multi-thread? test-util?
-
Includes basic task execution capabilities
- rt-multi-thread full? = num_cpus, rt
- signal full? = libc, signal-hook-registry
-
Enables os-poll, net and os-ext of mio, Win32_Foundation and Win32_System_Console of windows-sys
- sync time full? test-util?
- test-util = rt, sync, time
- stats
-
Technically, removing this is a breaking change even though it only ever did anything with the unstable flag on. It is probably safe to get rid of it after a few releases.
Features from optional dependencies
In crates that don't use the dep:
syntax, optional dependencies automatically become Cargo features.
- tokio-macros macros?
- bytes io-util? process?
- mio implicit feature
- num_cpus rt-multi-thread?
- parking_lot full?
- tracing cfg(tokio_unstable) implicit feature
-
With std
Affects
join_set::Builder
… - windows-sys cfg(windows) implicit feature
- socket2 cfg(not(target_family = "wasm")) net?
-
With all
- signal-hook-registry cfg(unix) process? signal?
- libc cfg(unix) net? process? signal?