From 01f3eefc12b205a66ce3e2b04c579070d01d9152 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Mon, 30 Dec 2024 12:15:14 +1100 Subject: [PATCH] io: Move bridge type constructors Put the constructors at the top of the impl block. Code move only. --- io/src/bridge.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/io/src/bridge.rs b/io/src/bridge.rs index a979f7387..fe37f4292 100644 --- a/io/src/bridge.rs +++ b/io/src/bridge.rs @@ -123,18 +123,6 @@ impl ToStd { #[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 { @@ -149,6 +137,18 @@ impl ToStd { // 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 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 } } impl std::io::Read for ToStd {