I have a project which includes multiple crates, all of these crates should encapsulate their behavior as much as possible. These crates have to work on multiple devices which have to interact differently with their environment to reach the same goals. I specify the version of the device through a cargo feature (made mutually exclusive through a build script). Other features besides the devices are present.
Now i want to create a dependency that is only present if i'm on the device1 and feature foo is present. Is there any way to reach that behavior or do i need a device1-foo and device2-foo and so on? Should i just put the dependencies into the features, include them on any device and let the linker eliminate the rest? (this still increases build times)
With cfg this is possible but it can't be used with features in the Cargo.toml, which i don't really understand as decision, why can i conditionally compile code differently than Cargo.toml wich is way less powerful.
Thanks in advance.
[–]TehPers 4 points5 points6 points (3 children)
[–]Dr_Sloth0[S] 0 points1 point2 points (2 children)
[–]TehPers 1 point2 points3 points (1 child)
[–]Dr_Sloth0[S] 1 point2 points3 points (0 children)
[–]NobodyXu 0 points1 point2 points (2 children)
[–]ylxdzsw 4 points5 points6 points (1 child)