Add #[inline] to as_deref
This commit is contained in:
parent
511364e787
commit
d3352def96
@ -1310,6 +1310,7 @@ pub const fn ok_or_else<E, F>(self, err: F) -> Result<T, E>
|
||||
/// let x: Option<String> = None;
|
||||
/// assert_eq!(x.as_deref(), None);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "option_deref", since = "1.40.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
pub const fn as_deref(&self) -> Option<&T::Target>
|
||||
@ -1336,6 +1337,7 @@ pub const fn as_deref(&self) -> Option<&T::Target>
|
||||
/// x
|
||||
/// }), Some("HEY".to_owned().as_mut_str()));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "option_deref", since = "1.40.0")]
|
||||
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
|
||||
pub const fn as_deref_mut(&mut self) -> Option<&mut T::Target>
|
||||
|
@ -908,6 +908,7 @@ pub fn inspect_err<F: FnOnce(&E)>(self, f: F) -> Self {
|
||||
/// let y: Result<&str, &u32> = Err(&42);
|
||||
/// assert_eq!(x.as_deref(), y);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "inner_deref", since = "1.47.0")]
|
||||
pub fn as_deref(&self) -> Result<&T::Target, &E>
|
||||
where
|
||||
@ -934,6 +935,7 @@ pub fn as_deref(&self) -> Result<&T::Target, &E>
|
||||
/// let y: Result<&mut str, &mut u32> = Err(&mut i);
|
||||
/// assert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "inner_deref", since = "1.47.0")]
|
||||
pub fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut E>
|
||||
where
|
||||
|
Loading…
Reference in New Issue
Block a user