How to set feature options for cargo build?

Viewed 663

I use this kind of things:

#[cfg(feature = "myfeature")]

When I click "Build - Build Project" it calls cargo build. How can I specify that I want myfeature to be used? I found that I can specify it for my Run configuration but still it doesn't work for "Build".

1 Answers

On the command line, you'd use cargo build --features myfeature. In clion using the IntelliJ Rust plugin, you should be able to open the Cargo.toml file and tick the box next to the feature definition to enable it within the IDE, as demonstrated in this blog post.

Related