diff --git a/api/io/all-features.txt b/api/io/all-features.txt index af10dd8871..055e6305d9 100644 --- a/api/io/all-features.txt +++ b/api/io/all-features.txt @@ -242,6 +242,8 @@ pub fn bitcoin_io::FromStd::fill_buf(&mut self) -> bitcoin_io::Result<&[u8]> pub fn bitcoin_io::FromStd::fill_buf(&mut self) -> std::io::error::Result<&[u8]> pub fn bitcoin_io::FromStd::flush(&mut self) -> bitcoin_io::Result<()> pub fn bitcoin_io::FromStd::flush(&mut self) -> std::io::error::Result<()> +pub fn bitcoin_io::FromStd::get_mut(&mut self) -> &mut T +pub fn bitcoin_io::FromStd::get_ref(&self) -> &T pub fn bitcoin_io::FromStd::inner(&self) -> &T pub fn bitcoin_io::FromStd::inner_mut(&mut self) -> &mut T pub fn bitcoin_io::FromStd::into_inner(self) -> T diff --git a/io/src/bridge.rs b/io/src/bridge.rs index 204a77a51e..a979f73870 100644 --- a/io/src/bridge.rs +++ b/io/src/bridge.rs @@ -12,18 +12,6 @@ impl FromStd { #[inline] pub const fn new(inner: T) -> Self { Self(inner) } - /// Returns the wrapped value. - #[inline] - pub fn into_inner(self) -> T { self.0 } - - /// Returns a reference to the wrapped value. - #[inline] - pub fn inner(&self) -> &T { &self.0 } - - /// Returns a mutable reference to the wrapped value. - #[inline] - pub fn inner_mut(&mut self) -> &mut T { &mut self.0 } - /// Wraps a mutable reference to IO type. #[inline] pub fn new_mut(inner: &mut T) -> &mut Self { @@ -38,6 +26,28 @@ impl FromStd { // SAFETY: the type is repr(transparent) and the pointer is created from Box unsafe { Box::from_raw(Box::into_raw(inner) as *mut Self) } } + + /// Returns the wrapped value. + #[inline] + pub fn into_inner(self) -> T { self.0 } + + /// 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 } } impl super::Read for FromStd {