//! Buffering wrappers for I/O traits
-use prelude::v1::*;
use io::prelude::*;
-use marker::Reflect;
use cmp;
use error;
use fmt;
///
/// Seeking always discards the internal buffer, even if the seek position
/// would otherwise fall within it. This guarantees that calling
- /// `.unwrap()` immediately after a seek yields the underlying reader at
- /// the same position.
+ /// `.into_inner()` immediately after a seek yields the underlying reader
+ /// at the same position.
///
/// See `std::io::Seek` for more details.
///
self.panicked = false;
r
} else {
- let amt = cmp::min(buf.len(), self.buf.capacity());
- Write::write(&mut self.buf, &buf[..amt])
+ Write::write(&mut self.buf, buf)
}
}
fn flush(&mut self) -> io::Result<()> {
}
#[stable(feature = "rust1", since = "1.0.0")]
-impl<W: Reflect + Send + fmt::Debug> error::Error for IntoInnerError<W> {
+impl<W: Send + fmt::Debug> error::Error for IntoInnerError<W> {
fn description(&self) -> &str {
error::Error::description(self.error())
}
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use io::prelude::*;
use io::{self, BufReader, BufWriter, LineWriter, SeekFrom};
use sync::atomic::{AtomicUsize, Ordering};