Fate of std::iter::iterate

I’ve just noticed that std::iter::iterate has been deprecated. It seems that the previous deprecation warning was inaccurate in claiming that it had retained its position.

I’m just wondering where I can find discussion of how this decision was reached? For what it’s worth, I’ve been using iterate and has found it to be quite useful.

Does anyone have a good suggestion for where I can find a replacement?

2 Likes

The itertools crate has Unfold: https://bluss.github.io/rust-itertools/doc/itertools/struct.Unfold.html

iterate (which is based on Unfold) could probably be added there as well. CC @bluss

Yes. I adopted unfold after its deprecation in libstd (I can’t find the relevant PR number now). Deliberately chose to wait for iterate to see if it would be championed by a user. A PR is welcome! Itertools is license compatible with rust to allow easy back and forth transfer.

I use it too. It is unfortunate such basic building block for iterators is deprecated.

I think Unfold is a general, nice and very useful tool, so I understand if it is missed. In the long run I hope the “best” things from itertools are adopted by libstd – for example Unfold, .join(), .intersperse(), .foreach().

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.