未验证 提交 7f81a299 编写于 作者: K kennytm

Rollup merge of #59221 - czipperz:as_ref_documentation, r=Centril

Option and Result: Add references to documentation of as_ref and as_mut

This makes the documentation more consistent with that of `Pin::as_ref` which converts "from `&Pin<Pointer<T>>` to `Pin<&t>`".

This generally makes it clearer that the reference is going inside the option.
......@@ -210,7 +210,7 @@ pub fn is_none(&self) -> bool {
// Adapter for working with references
/////////////////////////////////////////////////////////////////////////
/// Converts from `Option<T>` to `Option<&T>`.
/// Converts from `&Option<T>` to `Option<&T>`.
///
/// # Examples
///
......@@ -239,7 +239,7 @@ pub fn as_ref(&self) -> Option<&T> {
}
}
/// Converts from `Option<T>` to `Option<&mut T>`.
/// Converts from `&mut Option<T>` to `Option<&mut T>`.
///
/// # Examples
///
......
......@@ -369,7 +369,7 @@ pub fn err(self) -> Option<E> {
// Adapter for working with references
/////////////////////////////////////////////////////////////////////////
/// Converts from `Result<T, E>` to `Result<&T, &E>`.
/// Converts from `&Result<T, E>` to `Result<&T, &E>`.
///
/// Produces a new `Result`, containing a reference
/// into the original, leaving the original in place.
......@@ -394,7 +394,7 @@ pub fn as_ref(&self) -> Result<&T, &E> {
}
}
/// Converts from `Result<T, E>` to `Result<&mut T, &mut E>`.
/// Converts from `&mut Result<T, E>` to `Result<&mut T, &mut E>`.
///
/// # Examples
///
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册