Skip to main content

One doc tagged with "trait-bounds"

View all tags

Trait Bounds

We've defined traits and implemented them on types. Now it's time to connect these concepts to generics to unlock their full potential. In this article, we'll explore trait bounds, the syntax we use to constrain generic types. This is how we inform the compiler that a generic type T must have certain behaviors, finally allowing us to solve the largest function problem we encountered earlier.