io: Move constructors
Put all the constructors together. Internal change only.
This commit is contained in:
parent
72cc88d907
commit
b7fdb359e7
|
@ -12,18 +12,6 @@ impl<T> FromStd<T> {
|
|||
#[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,18 @@ impl<T> FromStd<T> {
|
|||
// 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<T: std::io::Read> super::Read for FromStd<T> {
|
||||
|
|
Loading…
Reference in New Issue