I’m maintaining a library that provides partial high-level abstractions of another library (glium_sdl2 -> SDL2).
Suppose I have the libraries
foo is a utility library that extends (but doesn’t replace) the capabilities of library
myapp needs to have access to both crates simultaneously. It is desirable for users to continue using
bar as an autonomous crate, and for
foo to call into and accept data from
extern crate foo; // How do I access the `bar` crate, as used by `foo`? extern crate bar; let b = bar::Bar::new(); foo::consume_bar(b);
[dependencies] foo = "0.1"
[package] name = "foo" version = "0.1.1" [dependencies] bar = "0.5"
[package] name = "bar" version = "0.5.8"
Is there a way to refer to
foo::bar inside the program without hard-coding what the version is supposed to be in
It’s important not to have to add something like
bar = "0.5" at the end of
myapp/Cargo.toml, in the case that
foo = "*".
Sorry if this is worded poorly.