What is the best way to make a crate compatible with the beta (and eventually stable) channel, while using unstable features/APIs if compiled with a nightly channel release? As an example, take the ecs-rs crate: it’s only incompatible with the beta because it uses
VecMap<T> which are behind feature gates. There are less efficient alternatives in the beta channel that could be easily substituted for these unstable features (cf. https://github.com/tomjakubowski/ecs-rs/commit/52cfc692224e634d882e3feb5347109db4e2e84e).
Would this be an appropriate use of Cargo features (combined with
#[cfg_attr(.)] and #[cfg(..)], to swap out implementations depending on Rust release one wishes to use? It seems like it could be problematic (consider if
ecs-rs is a transitive dependency, for example). Is this a feature worth supporting directly in Cargo?