io: Use get_ref / get_mut API
Currently in the `bridge` module to get a reference and mutable reference we provide the `as_inner` and `inner_mut` functions. These names are not in line with the `std::io` module which favours `get_ref` and `get_mut`. Add inherent functions `get_ref` and `get_mut` for accessing the wrapped value in `bridge::ToStd` and deprecate `as_inner` and `inner_mut`. To convince yourself this API is correct grep the stdlib `io` module for `fn get_ref` as opposed to `fn as_ref`. Close: #3832
This commit is contained in:
parent
b7fdb359e7
commit
88dfd4e8f2
|
@ -33,10 +33,20 @@ impl<T> FromStd<T> {
|
|||
|
||||
/// Returns a reference to the wrapped value.
|
||||
#[inline]
|
||||
pub fn get_ref(&self) -> &T { &self.0 }
|
||||
|
||||
/// Returns a mutable reference to the wrapped value.
|
||||
#[inline]
|
||||
pub fn get_mut(&mut self) -> &mut T { &mut self.0 }
|
||||
|
||||
/// Returns a reference to the wrapped value.
|
||||
#[inline]
|
||||
#[deprecated(since = "TBD", note = "use `get_ref()` instead")]
|
||||
pub fn inner(&self) -> &T { &self.0 }
|
||||
|
||||
/// Returns a mutable reference to the wrapped value.
|
||||
#[inline]
|
||||
#[deprecated(since = "TBD", note = "use `get_ref()` instead")]
|
||||
pub fn inner_mut(&mut self) -> &mut T { &mut self.0 }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue