Follow-up question about type constraints

⚓ Rust    📅 2025-07-09    👤 surdeus    👁️ 4      

surdeus

Hey folks,

I'm refering to this thread from a few days ago.

I played around a bit further and also tried with GATs:

trait MyTrait {
    type Gat<U>;
}

struct MyStruct<F, T, U>
where
    F: MyTrait<Gat<U> = T>,
{
    f: F,
}

Although it's now a GAT instead of an AT there can still only exist one impl of the trait per type. So shouldn't this work?

Regards
keks

3 posts - 2 participants

Read full topic

🏷️ rust_feed