Category "traits"

Lifetime sub-typing and impl-trait

I bumped into an interesting form of lifetime sub-typing, which I think is valid, but the compiler is skeptical of. Consider the following function, which compu

Rust: additional trait bounds in conjunction with higher-ranked lifetime bounds

I want trait implementations in Rust to be able to return arbitrary iterators (of specific item type) that may reference the original object with a lifetime 'a

Pick preferred implementation on conflicting trait implementation (using negative bounds)

I am working on a Rust program where I got stuck on a problem that can be reduced to following case: struct Pair<L, R> { left: L, right: R, } // Retu

How can I create an is_prime function that is generic over various integer types?

I just took the dive into Rust and want to make some basic math functions that are generic. I have the following is_prime function: fn is_prime(n: i64) -> b