@@ -67,12 +67,19 @@ person.greet();
6767As shown above, we are able to call ` person.greet() ` without having a context-specific
6868implementation of ` CanGreet ` for ` Person ` .
6969
70+ ## Extension Traits
71+
7072The use of blanket trait implementation is commonly found in many Rust libraries today.
7173For example, [ ` Itertools ` ] ( https://docs.rs/itertools/latest/itertools/trait.Itertools.html )
7274provides a blanket implementation for any context that implements ` Iterator ` .
7375Another example is [ ` StreamExt ` ] ( https://docs.rs/futures/latest/futures/stream/trait.StreamExt.html ) ,
7476which is implemented for any context that implements ` Stream ` .
7577
78+ Traits such as ` Itertools ` and ` StreamExt ` are sometimes known as _ extension traits_ . This is
79+ because the purpose of the trait is to _ extend_ the behavior of existing types, without having
80+ to own the type or base traits. While the use of extension traits is a common use case for
81+ blanket implementations, there are other ways we can make use of blanket implementations.
82+
7683## Overriding Blanket Implementations
7784
7885Traits containing blanket implementation are usually not meant to be implemented manually
@@ -215,6 +222,6 @@ Although a context many define its own context-specific provider to override the
215222provider, it would face other limitations such as not being able to implement other traits
216223that may cause a conflict.
217224
218- In practice, we consider that blanket implementations allow for _ singular context-generic provider_
225+ In practice, we consider that blanket implementations allow for _ a singule context-generic provider_
219226to be defined. In future chapters, we will look at how to relax the singular constraint,
220227to make it possible to allow _ multiple_ context-generic or context-specific providers to co-exist.
0 commit comments