Closed sharksforarms closed 6 years ago
Yes; if both crates have the same flame
version, then everything should work out.
Ok so if I do nightly only without feature-guarding it it works, but with feature guards it doesn't
https://github.com/sharksforarms/testflame
cargo +nightly run --features flame_it
Doesn't seem to get the flame'd functions which aren't in the main crate i.e. myothercrate::hello_world_from_other
Maybe related? https://github.com/rust-lang/cargo/issues/4106
Your repo only has a readme file in it. Can you publish again?
Done
I think that the problem is that this line where you import your subcrate needs to enable it's own feature.
the features that are both named flame_it
are not the same between crates.
Right, I changed it to this
myothercrate = { path = "./myothercrate", features = ["flame_it"] }
And it works. But now that means that the dependency myothercrate
is always compiling with the flame_it
feature
I think I got it!
Using the /
syntax in features = []
, funny enough I found out about this syntax in this ticket: https://github.com/rust-lang/cargo/issues/5139
[package]
name = "testflame"
version = "0.1.0"
authors = ["sharks"]
[workspace]
members = [
"myothercrate"
]
[dependencies]
myothercrate = {path = "./myothercrate", version = "0.1.0"}
flame = {version = "0.2.2", optional = true}
flamer = {version = "^0.2.1", optional = true}
[features]
default = []
flame_it = ["flame", "flamer", "myothercrate/flame_it"]
oh nice! Yeah, I gotta say I've never used features beyond the most trivial.
Looks like I can close this for now; if you run into anything else feel free to re-open or make a new issue!
Hello, I'm trying to use this across multiple crates, is this possible?