Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Punctuated::pop should return Option<T>, not Option<Pair<T, P>> #1600

Open
dtolnay opened this issue Mar 22, 2024 · 0 comments
Open

Punctuated::pop should return Option<T>, not Option<Pair<T, P>> #1600

dtolnay opened this issue Mar 22, 2024 · 0 comments

Comments

@dtolnay
Copy link
Owner

dtolnay commented Mar 22, 2024

first(), last(), iter() also do not produce Pair. We make you explicitly ask for Pair by writing pairs() or pairs().next() or pairs().next_back(), since wanting the whole Pair is uncommon.

pop() should change as follows:

  impl<T, P> Punctuated<T, P> {
-     pub fn pop(&mut self) -> Option<Pair<T, P>>;
+     pub fn pop(&mut self) -> Option<T>;
+     pub fn pop_pair(&mut self) -> Option<Pair<T, P>>;  // (?)
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant