鉴于这个在子目录中使用本地包的小型库,我如何使其中一个依赖项可选,具体取决于是否启用了某个功能?
[package]
name = "image_load"
description = "Small wrapper for image reading API's."
version = "0.1.0"
[features]
default = ["use_png"]
[dependencies]
[dependencies.image_load_ppm]
path = "ppm"
# How to make this build _only_ when 'use_png' feature is enabled?
[dependencies.image_load_png]
path = "png"
Run Code Online (Sandbox Code Playgroud)
在阅读文档时,这将显示如何使用可选的外部依赖项.在上面的示例中,我使用的是一个本地子目录,我想要构建或不构建 - 基于一个功能.
如何image_load_png在use_png启用该功能时仅进行构建.