Add another iterator trait for pinned pointers?

Currently, next method in the Iterator trait can only accept &mut Self as it's argument, therefore it's impossible to implement Iterator for those types that implements !Unpin trait.

Stream can accept Pin<&mut Self>, but it's primarily designed for asynchronous code. For synchronized code, Context is redundant.

So, are there plans to add another iterator trait for libstd to accept pinned pointers? Or is there an alternative without side effects?

You can implement Iterator for Pin<&mut YourStruct>.

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.