Skip to content

Commit

Permalink
add #[doc(alias="flatmap")] to Option::and_then
Browse files Browse the repository at this point in the history
I keep forgetting that rust calls this `and_then` and trying to search for `flatmap`.
`and_then`'s docs even mention "Some languages call this operation flatmap",
but it doesn't show up as a result in the search at `https://doc.rust-lang.org/std/?search=flatmap`
  • Loading branch information
Dante-Broggi authored Mar 13, 2023
1 parent cf8d98b commit 7fb34c9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/core/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,7 @@ impl<T> Option<T> {
/// let item_2_0 = arr_2d.get(2).and_then(|row| row.get(0));
/// assert_eq!(item_2_0, None);
/// ```
#[doc(alias = "flatmap")]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
Expand Down

0 comments on commit 7fb34c9

Please sign in to comment.