API parameters that are asserted to be non-zero should be of type NonZeroUsize or similar. #2742
Labels
A-tokio
Area: The main tokio crate
C-feature-request
Category: A feature request.
M-sync
Module: tokio/sync
A number of parameters in various tokio APIs are usizes that must be non-zero, e.g.
core_threads
,max_threads
, the argument tompsc::channel
, etc. The last one tripped me up when porting code becausecrossbeam::mpsc::channel(0)
is equivalent totokio::mpsc::channel(1)
. This can all be enforced in the type system and be caught at compile time.The text was updated successfully, but these errors were encountered: