Reputation: 1543
Given my trait T
and a large set of std
/core
arrays (not slices), How can I make implementations of T
for these arrays available to other crates on stable Rust?
From searching around, it seems my only options (that don't sidestep this problem) are to:
Option 1 is not acceptable. Option 2 leads to very long compile times (especially when the set of arrays exceeds 5000 types). Hiding every single implementation behind its own feature, i.e. feature impl-t-for-array-N
conditionally compiles in an implementation of T
for array [U;N]
, does considerably lower compilation time. (Compilation times went from from tens of minutes to a couple of seconds). However, the delay caused by processing thousands of features is still noticeable.
Is using features and manual implementations the most idiomatic way to handle this problem on stable rust, or is there a more idiomatic way I'm missing?
Upvotes: 1
Views: 309