Skip to content

Commit 6789527

Browse files
committed
rename ReadOnce back to Read, but keep it exposed
1 parent da37ad0 commit 6789527

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/io/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Contains various combinators to work with I/O objects and type definitions
44
//! as well.
55
6-
use std::io::{self, Read, Write};
6+
use std::io;
77

88
use futures::{BoxFuture, Async, Poll};
99
use futures::stream::BoxStream;
@@ -44,7 +44,7 @@ pub use self::copy::{copy, Copy};
4444
pub use self::flush::{flush, Flush};
4545
pub use self::read_exact::{read_exact, ReadExact};
4646
pub use self::read_to_end::{read_to_end, ReadToEnd};
47-
pub use self::read::{read, ReadOnce};
47+
pub use self::read::{read, Read};
4848
pub use self::read_until::{read_until, ReadUntil};
4949
pub use self::split::{ReadHalf, WriteHalf};
5050
pub use self::window::Window;
@@ -61,7 +61,7 @@ pub use self::write_all::{write_all, WriteAll};
6161
/// value that indicates "would block" the current future's task is arranged to
6262
/// receive a notification when the method would otherwise not indicate that it
6363
/// would block.
64-
pub trait Io: Read + Write {
64+
pub trait Io: io::Read + io::Write {
6565
/// Tests to see if this I/O object may be readable.
6666
///
6767
/// This method returns an `Async<()>` indicating whether the object

src/io/read.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::io::{Error, Read};
21
use std::mem;
32

43
use futures::{Future, Poll};
@@ -16,32 +15,32 @@ enum State<R, T> {
1615
///
1716
/// The returned future will resolve to both the I/O stream and the buffer
1817
/// as well as the number of bytes read once the read operation is completed.
19-
pub fn read<R, T>(rd: R, buf: T) -> ReadOnce<R, T>
20-
where R: Read,
18+
pub fn read<R, T>(rd: R, buf: T) -> Read<R, T>
19+
where R: ::std::io::Read,
2120
T: AsMut<[u8]>
2221
{
23-
ReadOnce { state: State::Pending { rd: rd, buf: buf } }
22+
Read { state: State::Pending { rd: rd, buf: buf } }
2423
}
2524

2625
/// A future which can be used to easily read available number of bytes to fill
2726
/// a buffer.
2827
///
2928
/// Created by the [`read`] function.
30-
pub struct ReadOnce<R, T> {
29+
pub struct Read<R, T> {
3130
state: State<R, T>,
3231
}
3332

34-
impl<R, T> Future for ReadOnce<R, T>
35-
where R: Read,
33+
impl<R, T> Future for Read<R, T>
34+
where R: ::std::io::Read,
3635
T: AsMut<[u8]>
3736
{
3837
type Item = (R, T, usize);
39-
type Error = Error;
38+
type Error = ::std::io::Error;
4039

41-
fn poll(&mut self) -> Poll<(R, T, usize), Error> {
40+
fn poll(&mut self) -> Poll<(R, T, usize), ::std::io::Error> {
4241
let nread = match self.state {
4342
State::Pending { ref mut rd, ref mut buf } => try_nb!(rd.read(&mut buf.as_mut()[..])),
44-
State::Empty => panic!("poll a ReadOnce after it's done"),
43+
State::Empty => panic!("poll a Read after it's done"),
4544
};
4645

4746
match mem::replace(&mut self.state, State::Empty) {

0 commit comments

Comments
 (0)