Adding constraints to trait

Suppose we have:

trait  Foo {
  type A;
  type B;
}

Does Rust allow us to express additional constraints, i.e. "B impls some trait [that takes A as a generic argument]"

2 Likes
trait Foo {
  type A;
  type B: std::ops::Add<Self::A>;
}
4 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.