Rust's generics are quite strict (types are verified abstractly at the point of definition, not against concrete types at the point of use). This means they sometimes need verbose trait bounds, and are very sensitive to wrong/imprecise lifetime annotations.
Especially for numeric code I'd suggest using macros instead. Generic monomorphisation duplicates code anyway, so macros aren't as terrible as they may seem. Rust's macros are a bit closer to C++ templates than generics are.
Especially for numeric code I'd suggest using macros instead. Generic monomorphisation duplicates code anyway, so macros aren't as terrible as they may seem. Rust's macros are a bit closer to C++ templates than generics are.