Skip to content

Doc suggestion: show output for next_back() example #34065

Closed
@xpe

Description

@xpe

For me, at least, the example using next() and next_back() tells the story better if it shows the output.

I'm reading about the DoubleEndedIterator

Thanks to mbrubeck on #rust-beginners for these examples:

let mut iter = vec![1,2,3,4,5].into_iter(); (iter.next(), iter.next_back())
(Some(1), Some(5))
let mut i = vec![1,2,3,4,5].into_iter(); (i.next(), i.next_back(), i.next(), i.next_back())
(Some(1), Some(5), Some(2), Some(4))

I plan to come back to this issue and submit a proper documentation patch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions