Tracking Issue for PeekableIterator · Issue #132973 · rust-lang/rust (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@bluebear94

Description

@bluebear94

Feature gate: #![feature(peekable_iterator)]

This is a tracking issue for the PeekableIterator trait, which extends Iterator with peek and related methods that inspect the next element without consuming it.

Public API

// core::iter

pub trait PeekableIterator: Iterator { type PeekedItem<'a>: BorrowSelf::Item + 'a where Self: 'a; fn peek(&self) -> Option<PeekedItem<'_>>; fn next_if(&mut self, func: impl FnOnce(&Self::Item) -> bool) -> OptionSelf::Item; fn next_if_eq(&mut self, expected: &T) -> OptionSelf::Item where Self::Item: PartialEq, T: ?Sized; }

Steps / History

Unresolved Questions

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html