A waltz through iterators in , while discussing how type-driven API designs can help.

I had been wondering - "if I create my own iterator structure, how do I implement map and all the rest on it?" During this talk it clicked for me why I don't have to.

Also loved the bit at the end between bound and unbound.

Show thread

@finity even manually creating iterator structures will be far less common once generators become stable. They will let you `yield` values from a function, creating an iterator. Until then, another Iterator creation tool you should check out is std::iter::from_fn!

@brk awesome! I've seen from_fn used before, but haven't tried it. I was wondering if something like generators were in the language - that's great that they're coming. I love them in Python for a bunch of tasks.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.