Rusty weight: how to use different functions for a print when a certain function is turned on?

For example, I define 2 functions without dependencies:

[features]
default = []
py2 = []
py3 = []

Based on the selected function ( --features py3), I want to include various functions for the dependency ( cpython):

[dependencies.cpython]
default-features = false
# features = ["python27-sys"]      I want to select this if py2 is enabled
features = ["python3-sys"]
optional = true

Can I do it? Or can I just select the functions for the dependency from the command line?

+4
source share
1 answer

It was discussed here. This can be done with /.

[features]
default = []
py2 = ["cpython", "cpython/python27-sys"]
py3 = ["cpython", "cpython/python3-sys"]
unstable = []

[dependencies.cpython]
# git = "https://github.com/dgrunwald/rust-cpython.git"
default-features = false
optional = true

I did not see anything in the documentation or official pages.

+5
source

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


All Articles