3 ms·
I never understood this argument: you just have to look in Cargo.toml. Yes, for multi-target (eg lib + bin, ..) it can be a little more work to look it up. Bu
by the_duke 8y ago
I never understood this argument: you just have to look in Cargo.toml.
Yes, for multi-target (eg lib + bin, ..) it can be a little more work to look it up.
But the new system is SO much more convenient to use overall.
- est31 8y agoFor lib.rs in libraries or main.rs in binary only crates this works great. But if you have multiple examples, then each example can use any dev-dependency it wants and any of the normal dependencies. It's super hard to figure out which crates are needed to add to make an example compile locally. To give a concrete example, please look at this [1] Cargo.toml and this [2] example and try to figure out the crates its using. I've highlighted them in Cargo.toml, to show how irregular the use is [3]. We don't have test-only or binary only dependencies yet. They would make this a bit easier. I want to focus on the code I'm writing, not onto figuring out which crates I need to include. On the bright side though, the system is still better than what C++ got which is not knowing from which header a particular symbol came from :). [1]: https://github.com/djc/quinn/blob/e555d11a430b9760d149a2765998734b6acfcd4d/quinn/Cargo.toml https://github.com/djc/quinn/blob/e555d11a430b9760d149a27659... [2]: https://github.com/djc/quinn/blob/e555d11a430b9760d149a2765998734b6acfcd4d/quinn/examples/client.rs https://github.com/djc/quinn/blob/e555d11a430b9760d149a27659... [3]: https://gist.github.com/est31/7cb33e8a6b63c8798381bdb5e91a145a https://gist.github.com/est31/7cb33e8a6b63c8798381bdb5e91a14...
- the_duke 8y agoPoint taken! I also wish we could specify /examples or /tests specific dependencies in Cargo.toml. A question here is though if such a complex structure is so rare that making it easier for the 90%+ of crates is worth it, while inconveniencing the complex cases.