The lack of `impl Trait` in Rust trait definitions is a frustrating limitation. Eg I want my trait method to return an iterator instead of a vector, but don't want to specify the iterator type. You can overcome it, but it's gross and requires two nightly features:
trait FooExt {fn bar(&self) -> Vec<u32>} => trait FooExt { type Bar<'a>: Iterator<Item=u32> where Self: 'a; fn bar(&self) -> Self::Bar<'_>; } impl FooExt for Foo { type Bar<'a> where Self: 'a = impl Iterator<Item=u32>; fn bar(&self) -> Self::Bar<'_> { ... } }
cognitive psychology. PhD