-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Improve option API docs #40999
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
Improve option API docs #40999
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -894,9 +894,15 @@ impl<A> ExactSizeIterator for Item<A> {} | |
| impl<A> FusedIterator for Item<A> {} | ||
| unsafe impl<A> TrustedLen for Item<A> {} | ||
|
|
||
| /// An iterator over a reference of the contained item in an [`Option`]. | ||
| /// An iterator over a reference to the [`Some`] variant of an [`Option`]. | ||
| /// | ||
| /// The iterator yields one value if the [`Option`] is a [`Some`] variant, otherwise none. | ||
| /// | ||
| /// This `struct` is created by [`Option::iter`] function. | ||
|
||
| /// | ||
| /// [`Option`]: enum.Option.html | ||
| /// [`Some`]: enum.Option.html#variant.Some | ||
| /// [`Option::iter`]: enum.Option.html#method.iter | ||
| #[stable(feature = "rust1", since = "1.0.0")] | ||
| #[derive(Debug)] | ||
| pub struct Iter<'a, A: 'a> { inner: Item<&'a A> } | ||
|
|
@@ -933,9 +939,15 @@ impl<'a, A> Clone for Iter<'a, A> { | |
| } | ||
| } | ||
|
|
||
| /// An iterator over a mutable reference of the contained item in an [`Option`]. | ||
| /// An iterator over a mutable reference to the [`Some`] variant of an [`Option`]. | ||
| /// | ||
| /// The iterator yields one value if the [`Option`] is a [`Some`] variant, otherwise none. | ||
| /// | ||
| /// This `struct` is created by [`Option::iter_mut`] function. | ||
|
||
| /// | ||
| /// [`Option`]: enum.Option.html | ||
| /// [`Some`]: enum.Option.html#variant.Some | ||
| /// [`Option::iter_mut`]: enum.Option.html#method.iter_mut | ||
| #[stable(feature = "rust1", since = "1.0.0")] | ||
| #[derive(Debug)] | ||
| pub struct IterMut<'a, A: 'a> { inner: Item<&'a mut A> } | ||
|
|
@@ -964,9 +976,15 @@ impl<'a, A> FusedIterator for IterMut<'a, A> {} | |
| #[unstable(feature = "trusted_len", issue = "37572")] | ||
| unsafe impl<'a, A> TrustedLen for IterMut<'a, A> {} | ||
|
|
||
| /// An iterator over the item contained inside an [`Option`]. | ||
| /// An iterator over the value in [`Some`] variant of an [`Option`]. | ||
| /// | ||
| /// The iterator yields one value if the [`Option`] is a [`Some`] variant, otherwise none. | ||
| /// | ||
| /// This `struct` is created by [`Option::into_iter`] function. | ||
|
||
| /// | ||
| /// [`Option`]: enum.Option.html | ||
| /// [`Some`]: enum.Option.html#variant.Some | ||
| /// [`Option::into_iter`]: enum.Option.html#method.into_iter | ||
| #[derive(Clone, Debug)] | ||
| #[stable(feature = "rust1", since = "1.0.0")] | ||
| pub struct IntoIter<A> { inner: Item<A> } | ||
|
|
||
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.
can you remove "variant" here, it sounds more natural without it to me.