@@ -55,7 +55,7 @@ impl Error for ErrorKind {
5555 }
5656}
5757
58- /// Base trait for all IO traits.
58+ /// Base trait for all IO traits, defining the error type .
5959///
6060/// All IO operations of all traits return the error defined in this trait.
6161///
@@ -64,12 +64,12 @@ impl Error for ErrorKind {
6464/// This is very convenient when writing generic code, it means you have to
6565/// handle a single error type `T::Error`, instead of `<T as Read>::Error` and `<T as Write>::Error`
6666/// which might be different types.
67- pub trait Io {
67+ pub trait ErrorType {
6868 /// Error type of all the IO operations on this type.
6969 type Error : Error ;
7070}
7171
72- impl < T : ?Sized + crate :: Io > crate :: Io for & mut T {
72+ impl < T : ?Sized + crate :: ErrorType > crate :: ErrorType for & mut T {
7373 type Error = T :: Error ;
7474}
7575
@@ -150,7 +150,7 @@ impl<E: fmt::Debug> std::error::Error for WriteAllError<E> {}
150150/// Blocking reader.
151151///
152152/// Semantics are the same as [`std::io::Read`], check its documentation for details.
153- pub trait Read : crate :: Io {
153+ pub trait Read : crate :: ErrorType {
154154 /// Pull some bytes from this source into the specified buffer, returning how many bytes were read.
155155 fn read ( & mut self , buf : & mut [ u8 ] ) -> Result < usize , Self :: Error > ;
156156
@@ -174,7 +174,7 @@ pub trait Read: crate::Io {
174174/// Blocking buffered reader.
175175///
176176/// Semantics are the same as [`std::io::BufRead`], check its documentation for details.
177- pub trait BufRead : crate :: Io {
177+ pub trait BufRead : crate :: ErrorType {
178178 /// Return the contents of the internal buffer, filling it with more data from the inner reader if it is empty.
179179 fn fill_buf ( & mut self ) -> Result < & [ u8 ] , Self :: Error > ;
180180
@@ -185,7 +185,7 @@ pub trait BufRead: crate::Io {
185185/// Blocking writer.
186186///
187187/// Semantics are the same as [`std::io::Write`], check its documentation for details.
188- pub trait Write : crate :: Io {
188+ pub trait Write : crate :: ErrorType {
189189 /// Write a buffer into this writer, returning how many bytes were written.
190190 fn write ( & mut self , buf : & [ u8 ] ) -> Result < usize , Self :: Error > ;
191191
@@ -246,7 +246,7 @@ pub trait Write: crate::Io {
246246/// Blocking seek within streams.
247247///
248248/// Semantics are the same as [`std::io::Seek`], check its documentation for details.
249- pub trait Seek : crate :: Io {
249+ pub trait Seek : crate :: ErrorType {
250250 /// Seek to an offset, in bytes, in a stream.
251251 fn seek ( & mut self , pos : crate :: SeekFrom ) -> Result < u64 , Self :: Error > ;
252252
@@ -266,7 +266,7 @@ pub trait Seek: crate::Io {
266266///
267267/// This allows using a [`Read`] or [`BufRead`] in a nonblocking fashion, i.e. trying to read
268268/// only when it is ready.
269- pub trait ReadReady : crate :: Io {
269+ pub trait ReadReady : crate :: ErrorType {
270270 /// Get whether the reader is ready for immediately reading.
271271 ///
272272 /// This usually means that there is either some bytes have been received and are buffered and ready to be read,
@@ -280,7 +280,7 @@ pub trait ReadReady: crate::Io {
280280///
281281/// This allows using a [`Write`] in a nonblocking fashion, i.e. trying to write
282282/// only when it is ready.
283- pub trait WriteReady : crate :: Io {
283+ pub trait WriteReady : crate :: ErrorType {
284284 /// Get whether the writer is ready for immediately writing.
285285 ///
286286 /// This usually means that there is free space in the internal transmit buffer.
0 commit comments