File tree 1 file changed +6
-6
lines changed 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -611,12 +611,12 @@ reduce duplication but also specify to the compiler that we want the generic
611
611
type to have particular behavior. The compiler can then use the trait bound
612
612
information to check that all the concrete types used with our code provide the
613
613
correct behavior. In dynamically typed languages, we would get an error at
614
- runtime if we called a method on a type that the type didn’t implement. But
615
- Rust moves these errors to compile time so we’re forced to fix the problems
616
- before our code is even able to run. Additionally, we don’t have to write code
617
- that checks for behavior at runtime because we’ve already checked at compile
618
- time. Doing so improves performance without having to give up the flexibility
619
- of generics.
614
+ runtime if we called a method on a type which didn’t implement the type which
615
+ defines the method. But Rust moves these errors to compile time so we’re forced
616
+ to fix the problems before our code is even able to run. Additionally, we don’t
617
+ have to write code that checks for behavior at runtime because we’ve already
618
+ checked at compile time. Doing so improves performance without having to give
619
+ up the flexibility of generics.
620
620
621
621
Another kind of generic that we’ve already been using is called * lifetimes* .
622
622
Rather than ensuring that a type has the behavior we want, lifetimes ensure
You can’t perform that action at this time.
0 commit comments