Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
643: Implement `PeekingNext` transitively over mutable references. r=jswrenn a=olson-sean-k This PR allows `PeekingNext` to be used as a trait object just like `Iterator`, allowing code to accept types like `&mut dyn PeekingNext<Item = T>` for some item type `T`. To accomplish this, generic methods now require that `Self: Sized` and `PeekingNext` now has a transitive implementation over mutable references to types that implement `PeekingNext`. This mirrors the design of the `Iterator` trait ([here](https://doc.rust-lang.org/nightly/src/core/iter/traits/iterator.rs.html#776-782) and [here](https://doc.rust-lang.org/nightly/src/core/iter/traits/iterator.rs.html), for example). See also [this discussion on the Rust internals forum](https://internals.rust-lang.org/t/generic-methods-over-object-safe-traits/6774). Co-authored-by: Sean Olson <[email protected]>
- Loading branch information