I have been developing a chess engine and I have published it in crates.io for public use.
Links:
- https://crates.io/crates/timecat
- https://github.com/Gourab-Ghosh/timecat-rs/
My chess engine has differnet features defined. But by default I don’t want any of the features to be enabled in by default when it is used as a library. But when compiling it as a binary, I want the binary feature to be enabled.
Now if I add the binary feature in default features, while using it as a library I have to add it with the command cargo add timecat --no-default-features
(Currently this is the state of my library)
If I don’t add the binary feature in default features, while using it as a binary I have to install it with the command cargo install timecat --features binary
Both of them are not user friendly as many people do not read the documentation properly before using a crate.
What changes should I make in my code so that both cargo add timecat
and cargo install timecat
work as expected. (Please read the Cargo Features section in the README.md to know about each feature and then answer this question)
I have tried making virtual workspace and distributed the library part code in seperate filder and the binary part in another folder. It is compiling as a binary but I could not find a way to use it as a library. I tried to use it as a library by adding timecat = { path = "/path/to/timecat" }
but chatgpt is suggesting me to make the path /path/to/timecat/timecat_lib
which I don’t want to do. Here is the link of my experimentation.
Link: https://github.com/Gourab-Ghosh/timecat-virtual-workspace-experimentation
Gourab Ghosh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.