Skip to content

Commit 9374be1

Browse files
committed
Some<T> is not a type, etc
1 parent 20889fd commit 9374be1

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

Diff for: core/src/option.rs

+23-13
Original file line numberDiff line numberDiff line change
@@ -144,25 +144,35 @@
144144
//!
145145
//! ## Transforming contained values
146146
//!
147+
//! These transformations are from [`Option`] to [`Result`].
148+
//!
149+
//! * [`ok_or`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to
150+
//! [`Err(err)`] using the provided default `err` value
151+
//! * [`ok_or_else`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to
152+
//! a value of [`Err`] using the provided function
153+
//! * [`transpose`] transposes an [`Option`] of a [`Result`] into a
154+
//! [`Result`] of an [`Option`]
155+
//!
156+
//! These transformations are on [`Some`] values.
157+
//!
147158
//! * [`filter`] calls the provided predicate function on the contained
148159
//! value `t` if the [`Option`] is [`Some(t)`], and returns [`Some(t)`]
149160
//! if the function returns `true`; otherwise, returns [`None`]
150161
//! * [`flatten`] removes one level of nesting from an
151162
//! [`Option<Option<T>>`]
152-
//! * [`map`] transforms [`Some<T>`] to [`Some<U>`] using the provided
163+
//! * [`map`] transforms [`Option<T>`] to [`Option<U>`] by applying the
164+
//! provided function to the contained value of [`Some`] and leaving
165+
//! [`None`] values unchanged
166+
//! * [`map_or`] transforms [`Option<T>`] to a value of `U` by applying the
167+
//! provided function to the contained value of [`Some`], or transforms
168+
//! [`None`] to a provided default value of `U`
169+
//! * [`map_or_else`] transforms [`Option<T>`] to a value of `U` by
170+
//! applying the provided function to the contained value of [`Some`], or
171+
//! transforms [`None`] to a value of `U` using a provided fallback
153172
//! function
154-
//! * [`map_or`] transforms [`Some<T>`] to a value of `U` using the
155-
//! provided function, or transforms [`None`] to a provided default value
156-
//! of `U`
157-
//! * [`map_or_else`] transforms [`Some<T>`] to a value of `U` using the
158-
//! provided function, or transforms [`None`] to a value of `U` using
159-
//! another provided function
160-
//! * [`ok_or`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to
161-
//! [`Err(err)`] using the provided default `err` value
162-
//! * [`ok_or_else`] transforms [`Some(v)`] to [`Ok(v)`], and [`None`] to
163-
//! a value of [`Err<E>`] using the provided function
164-
//! * [`transpose`] transposes an [`Option`] of a [`Result`] into a
165-
//! [`Result`] of an [`Option`]
173+
//!
174+
//! These transformations combine two [`Some`] values.
175+
//!
166176
//! * [`zip`] returns [`Some((s, o))`] if `self` is [`Some(s)`] and the
167177
//! provided [`Option`] value is [`Some(o)`]; otherwise, returns [`None`]
168178
//! * [`zip_with`] calls the provided function `f` and returns

0 commit comments

Comments
 (0)