Skip to content

Commit

Permalink
Touch up PR 1368
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Aug 15, 2024
1 parent 6afd5ac commit e9f6c71
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/unique_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ use core::marker::PhantomData;
use core::mem::{self, MaybeUninit};
use core::ops::{Deref, DerefMut};
use core::pin::Pin;

#[cfg(feature = "std")]
use std::io::Read;
use std::io::{self, Read};

/// Binding to C++ `std::unique_ptr<T, std::default_delete<T>>`.
#[repr(C)]
Expand Down Expand Up @@ -184,31 +183,32 @@ where
}
}

/// Forwarding `Read` trait implementation in a manner similar to `Box<T>`. Note that the
/// implementation will panic for null `UniquePtr<T>`.
/// Forwarding `Read` trait implementation in a manner similar to `Box<T>`.
///
/// Note that the implementation will panic for null `UniquePtr<T>`.
#[cfg(feature = "std")]
impl<T> Read for UniquePtr<T>
where
for<'a> Pin<&'a mut T>: Read,
T: UniquePtrTarget,
{
#[inline]
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.pin_mut().read(buf)
}

#[inline]
fn read_to_end(&mut self, buf: &mut std::vec::Vec<u8>) -> std::io::Result<usize> {
fn read_to_end(&mut self, buf: &mut std::vec::Vec<u8>) -> io::Result<usize> {
self.pin_mut().read_to_end(buf)
}

#[inline]
fn read_to_string(&mut self, buf: &mut std::string::String) -> std::io::Result<usize> {
fn read_to_string(&mut self, buf: &mut std::string::String) -> io::Result<usize> {
self.pin_mut().read_to_string(buf)
}

#[inline]
fn read_exact(&mut self, buf: &mut [u8]) -> std::io::Result<()> {
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
self.pin_mut().read_exact(buf)
}

Expand Down

0 comments on commit e9f6c71

Please sign in to comment.