Skip to content

Tracking issue for iter_order_by #64295

Description

@KodrAus

Landed in #62205

Public API

pub mod core {
    pub mod iter {
        mod traits {
            mod iterator {
                pub trait Iterator {
                    fn cmp_by<I, F>(mut self, other: I, mut cmp: F) -> Ordering
                    where
                        Self: Sized,
                        I: IntoIterator,
                        F: FnMut(Self::Item, I::Item) -> Ordering,
                    {
                    }
                    fn partial_cmp_by<I, F>(
                        mut self,
                        other: I,
                        mut partial_cmp: F,
                    ) -> Option<Ordering>
                    where
                        Self: Sized,
                        I: IntoIterator,
                        F: FnMut(Self::Item, I::Item) -> Option<Ordering>,
                    {
                    }
                    fn eq_by<I, F>(mut self, other: I, mut eq: F) -> bool
                    where
                        Self: Sized,
                        I: IntoIterator,
                        F: FnMut(Self::Item, I::Item) -> bool,
                    {
                    }
                }
            }
        }
    }
}

Before stabilization:

  • Stabilization PR

Open questions

  • Should we use size_hint as an optimization for equality checking? That means buggy iterators may return incorrect results for eq_by. We could optimize for just a handful of TrustedLen iterators instead.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-iteratorsArea: IteratorsB-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions