Skip to content

Commit 01a16a6

Browse files
Update posts/2022-04-07-Rust-1.60.0.md
Co-authored-by: Ryan Levick <[email protected]>
1 parent 1248cfd commit 01a16a6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

posts/2022-04-07-Rust-1.60.0.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ jpeg-decoder = { version = "0.1.20", default-features = false, optional = true }
8686
parallel = ["jpeg-decoder/rayon"]
8787
```
8888

89-
There are two things to note in this example. First, the optional dependency `jpeg-decoder` implicitly defines a feature of the same name, which provides a means to enable the dependency. Second, the `"jpeg-decoder/rayon"` syntax enables the `rayon` feature of the `jpeg-decoder` dependency, *and* also enables the `jpeg-decoder` dependency.
89+
There are two things to note in this example:
90+
* The optional dependency `jpeg-decoder` implicitly defines a feature of the same name. Enabling the `jpeg-decoder` feature will enable the `jpeg-decoder` dependency.
91+
* The `"jpeg-decoder/rayon"` syntax enables the `jpeg-decoder` dependency *and* enables the `jpeg-decoder` dependency's `rayon` feature.
9092

9193
Namespaced features tackles the first issue that optional dependencies are implicitly exposed as part of a package's public interface. You can now use the `dep:` prefix in the `[features]` table to explicitly refer to an optional dependency. This gives you more control to define the feature corresponding to the optional dependency, and to hide optional dependencies behind more descriptive feature names.
9294

0 commit comments

Comments
 (0)