Associated Types vs Generics
Associated Types vs Generics
Associated types simplify trait definitions when there is a unique type output per implementation:
trait DataSink {
type Error;
fn send(&mut self, bytes: &[u8]) -> Result<(), Self::Error>;
}