How can I include two functions that could lead to a conflict in Rust?

I have two options: feature_1and feature_2:

[features]
default = ["feature_1"]
feature_1 = []
feature_2 = []

I want the user to select only one of them at a time, because selecting both at the same time will lead to duplication of some important code and for some other reasons. How can i do this?

+4
source share
1 answer

Basically, you cannot. Cargo functions are additive, and functions can be enabled by any box in the dependency tree. It implies an assumption on the part of Cargo that it is always valid for the inclusion of additional functions.

, - , . feature_1, feature_2, , . ( ) , , .

, . , , , . script , , , , .

+4

Source: https://habr.com/ru/post/1679322/


All Articles