I have project that build with cargo workspace with including lot of crates.
One of the lower level crates contains generic data-structure with a lot of serde-code involved.
In order to reduce the compile time , I tried to crate objects with monomorphized instances on the the data-struct in a crate that is lower in the compilation hierarchy and use those in the higher-level crates. My goal to compile the lower-level crate only once, and then work on the higher level crate - without generating the monomorphized instances every time.
example:
lower-level crate
-----------------
pub struct MyCache<T> {
//generic implementation of cache
}
pub struct MyCacheString {
cache: MyCache<String>
}
higher-level crate
------------------
use MyCacheString;
but the problem is that the compiler generated that monomorphized in the higer-level crate (according to "cargo llvm-lines")
Is there is a way to ask/force the compiler to generate the monorphized code while it's compile the lower level crate?