As per #1318, Tokio has been merged into a single crate and components are split by feature flag. Now, with all features enabled, the tokio crate is quite heavy.
Regardless of the direction, two things will happen:
- documentation: the required feature flag for all components will be documented similar to how Tonic does this (see
transport module here: https://docs.rs/tonic/0.1.0-alpha.6/tonic/).
- meta feature: A
full feature flag will be provided that enables all Tokio feature flags.
The question is, should default include all features, no features, or some features.
Default on
One of the main drawbacks mentioned in #1318 was that, when features are enabled by default, libraries will accidentally depend on more features than necessary. Doing so will force these features to be enabled by consumers of the library. Also, the end user can accidentally use features that were enabled by the dependency. When the dependency changes its feature flags, the application breaks as the required features are no longer available.
Default off
An alternative would be to default to no feature flags enabled by default. In this case, depending on tokio will only enable core traits (AsyncRead, AsyncWrite, ToSocketAddrs) and an empty Runtime type that doesn't do much when used. Getting started guides, examples, the README would instruct users to depend on tokio as:
tokio = { version = "0.2.0", features = ["full"] }
Libraries will be instructed to pick only the features they require. The primary drawback of this strategy is that it adds a bump to the getting started flow.
Default some
A middle ground would be to define a subset of features that should be enabled by default. It is unclear how to pick the features to enable by default as different Tokio users use significantly different feature sets. Because the choice is arbitrary, the end user will have no way to intuit if a feature is enabled by default or not.
As per #1318, Tokio has been merged into a single crate and components are split by feature flag. Now, with all features enabled, the
tokiocrate is quite heavy.Regardless of the direction, two things will happen:
transportmodule here: https://docs.rs/tonic/0.1.0-alpha.6/tonic/).fullfeature flag will be provided that enables all Tokio feature flags.The question is, should
defaultinclude all features, no features, or some features.Default on
One of the main drawbacks mentioned in #1318 was that, when features are enabled by default, libraries will accidentally depend on more features than necessary. Doing so will force these features to be enabled by consumers of the library. Also, the end user can accidentally use features that were enabled by the dependency. When the dependency changes its feature flags, the application breaks as the required features are no longer available.
Default off
An alternative would be to default to no feature flags enabled by default. In this case, depending on
tokiowill only enable core traits (AsyncRead,AsyncWrite,ToSocketAddrs) and an emptyRuntimetype that doesn't do much when used. Getting started guides, examples, the README would instruct users to depend on tokio as:Libraries will be instructed to pick only the features they require. The primary drawback of this strategy is that it adds a bump to the getting started flow.
Default some
A middle ground would be to define a subset of features that should be enabled by default. It is unclear how to pick the features to enable by default as different Tokio users use significantly different feature sets. Because the choice is arbitrary, the end user will have no way to intuit if a feature is enabled by default or not.