Let's say I have a library with various modules in it and different constants defined.
Is it possible to somehow use that library as dependency and create another one (extended version) which contains redefined const
values for functions in original lib?
Something like:
original lib.rs
const VER: &str = "original";
pub mod version {
pub fn get_version() -> &str {
super::VER
}
}
extended lib.rs
use original_lib::*;
const VER: &str = "extended";
. . . // ???
so that I could do
#[cfg(feature = "orig")]
extern crate lib_orig as lib;
#[cfg(feature = "ext")]
extern crate lib_ext as lib;
fn main() {
let ver = lib::version::get_version(); // ver either "original" or "extended" based on selected feature
}