-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Guide iterators #16887
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
Guide iterators #16887
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,10 @@ | |
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
//! A double-ended queue implemented as a circular buffer. | ||
//! | ||
//! `RingBuf` implements the trait `Deque`. It should be imported with | ||
//! `use collections::Deque`. | ||
//! This crate implements a double-ended queue with `O(1)` amortized inserts and removals from both | ||
//! ends of the container. It also has `O(1)` indexing like a vector. The contained elements are | ||
//! not required to be copyable, and the queue will be sendable if the contained type is sendable. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of interest, why did you keep these copyable and sendable comments only for deque? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there another place it should be too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well the original page has it for multiple types:
I was just wondering if there was a reason that only deque had this snippet transferred. I don't actually think we should bother mentioning these for each type; just have a general section in the main docs about this sort of basic type requirement/implication with only the exceptions with an explicit note like this. (i.e. almost all the basic collections have unique ownership & inherited mutability and are careful with their contents, and thus satisfy these properties. Being nonsendable or requiring copy is the 'surprising' case.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh. I was looking in the wrong place, because that paragraph comes form here: https://github.com/rust-lang/rust/pull/16887/files#diff-cc3af746394f582ee863741589439e75L45 I don't remember specifically why, may even just be my own error. |
||
//! Its interface `Deque` is defined in `collections`. | ||
|
||
use core::prelude::*; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line must be really close to 100, if it's not over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I let vim handle such things, maybe I should double check.