Skip to content

Laziness in tuple_windows #601

@aobatact

Description

@aobatact

I was bit surprised by that Itertools::tuple_windows is not somewhat lazy and has side effect.
It is consuming the first tuple when calling Itertools::tuple_windows .

https://doc.rust-lang.org/nightly/core/iter/index.html#laziness says that adapters in Iterator is lazy and
the TupleWindows has #[must_use = "iterator adaptors are lazy and do nothing unless consumed] since #227

So the question is

  • Is this intended behavior?
  • Should (all) adapters in Itertools be lazy?
  • Should the laziness be documented?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions