Skip to content

ConIterOfRange must have trait bound Idx: std::iter::Step #1

Open
@orxfun

Description

@orxfun

Currently, we cannot use this directly because the Step trait is unstable. The issue can be tracked here: rust-lang/rust#42168

This causes adding manual and very noisy trait bounds:

where
    Idx: Send
        + Sync
        + Clone
        + Copy
        + From<usize>
        + Into<usize>
        + Add<Idx, Output = Idx>
        + Sub<Idx, Output = Idx>
        + Ord,

which could simply be replaced by

where
    Idx: Send + Sync + Step

A bigger problem is the implementation of the fetch_n method which even affects the type of the returned iterator.

  • If we could use Idx: Step trait bound, we could have simply returned begin_value..end_value.
  • However, now we need to return (begin_idx..end_idx).map(Idx::from)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions