Make most of Cursor available without collections. Fixes #4
This commit is contained in:
parent
60e5225eaa
commit
5694474891
@ -283,7 +283,7 @@ index 632ef3d..dd63ebe 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index a1002fd..3a00ffe 100644
|
||||
index a1002fd..292afd0 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index a1002fd..3a00ffe 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index a1002fd..3a00ffe 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
@@ -239,7 +228,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +233,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +255,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +261,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
let amt = (&mut self.inner[(pos as usize)..]).write(buf)?;
|
||||
diff --git a/error.rs b/error.rs
|
||||
index 9a605fc..d3d0814 100644
|
||||
--- a/error.rs
|
||||
@ -968,7 +982,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 28492b3..924d626 100644
|
||||
index 28492b3..aafb081 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -248,49 +248,32 @@
|
||||
@ -998,8 +1012,6 @@ index 28492b3..924d626 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1014,7 +1026,8 @@ index 28492b3..924d626 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1028,9 +1041,8 @@ index 28492b3..924d626 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -282,7 +282,7 @@ index a26a932..83ea558 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 1b836b7..c77f287 100644
|
||||
index 1b836b7..4840c92 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,9 +8,10 @@
|
||||
@ -357,23 +357,33 @@ index 1b836b7..c77f287 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -209,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -209,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -218,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -227,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -381,22 +391,26 @@ index 1b836b7..c77f287 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -239,7 +229,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +234,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +256,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +262,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index ddf0030..748b830 100644
|
||||
--- a/error.rs
|
||||
@ -974,7 +988,7 @@ index 03f55f7..f767e0c 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 1053792..5acfe6a 100644
|
||||
index 1053792..ae6a3c7 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,42 +247,32 @@
|
||||
@ -997,8 +1011,6 @@ index 1053792..5acfe6a 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1013,7 +1025,8 @@ index 1053792..5acfe6a 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1027,9 +1040,8 @@ index 1053792..5acfe6a 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index 632ef3d..dd63ebe 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index a1002fd..3a00ffe 100644
|
||||
index a1002fd..292afd0 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index a1002fd..3a00ffe 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index a1002fd..3a00ffe 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
@@ -239,7 +228,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +233,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +255,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +261,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
let amt = (&mut self.inner[(pos as usize)..]).write(buf)?;
|
||||
diff --git a/error.rs b/error.rs
|
||||
index 9a605fc..d3d0814 100644
|
||||
--- a/error.rs
|
||||
@ -968,7 +982,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 0f988c7..d6cd245 100644
|
||||
index 0f988c7..907172b 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -248,49 +248,32 @@
|
||||
@ -998,8 +1012,6 @@ index 0f988c7..d6cd245 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1014,7 +1026,8 @@ index 0f988c7..d6cd245 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1028,9 +1041,8 @@ index 0f988c7..d6cd245 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -282,7 +282,7 @@ index 21a0cc1..27c5ac1 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index ae0085f..5392880 100644
|
||||
index ae0085f..0f8029d 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,11 @@
|
||||
@ -292,8 +292,9 @@ index ae0085f..5392880 100644
|
||||
+use core::prelude::v1::*;
|
||||
use io::prelude::*;
|
||||
|
||||
use core::convert::TryInto;
|
||||
-use core::convert::TryInto;
|
||||
-use cmp;
|
||||
+#[cfg(feature = "collections")] use core::convert::TryInto;
|
||||
+use core::cmp;
|
||||
use io::{self, SeekFrom, Error, ErrorKind};
|
||||
|
||||
@ -358,23 +359,33 @@ index ae0085f..5392880 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +203,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +203,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +211,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +219,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -382,22 +393,26 @@ index ae0085f..5392880 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -240,7 +230,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -240,7 +235,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos: usize = self.position().try_into().map_err(|_| {
|
||||
@@ -270,7 +259,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -270,8 +265,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index ddf0030..748b830 100644
|
||||
--- a/error.rs
|
||||
@ -883,7 +898,7 @@ index 3824a5f..312cf47 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 7310564..05d91fc 100644
|
||||
index 7310564..0fafc60 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,42 +247,32 @@
|
||||
@ -906,8 +921,6 @@ index 7310564..05d91fc 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -922,7 +935,8 @@ index 7310564..05d91fc 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -936,9 +950,8 @@ index 7310564..05d91fc 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -282,7 +282,7 @@ index 4ff8c6a..fd4eb13 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 1b836b7..c77f287 100644
|
||||
index 1b836b7..4840c92 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,9 +8,10 @@
|
||||
@ -357,23 +357,33 @@ index 1b836b7..c77f287 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -209,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -209,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -218,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -227,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -381,22 +391,26 @@ index 1b836b7..c77f287 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -239,7 +229,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +234,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +256,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +262,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index ddf0030..748b830 100644
|
||||
--- a/error.rs
|
||||
@ -974,7 +988,7 @@ index 03f55f7..f767e0c 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 0de02cb..0f202c2 100644
|
||||
index 0de02cb..694f2fd 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,42 +247,32 @@
|
||||
@ -997,8 +1011,6 @@ index 0de02cb..0f202c2 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1013,7 +1025,8 @@ index 0de02cb..0f202c2 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1027,9 +1040,8 @@ index 0de02cb..0f202c2 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index 632ef3d..dd63ebe 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index a1002fd..3a00ffe 100644
|
||||
index a1002fd..292afd0 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index a1002fd..3a00ffe 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index a1002fd..3a00ffe 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
@@ -239,7 +228,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +233,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +255,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +261,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
let amt = (&mut self.inner[(pos as usize)..]).write(buf)?;
|
||||
diff --git a/error.rs b/error.rs
|
||||
index 9a605fc..d3d0814 100644
|
||||
--- a/error.rs
|
||||
@ -968,7 +982,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 6dd7273..ba07b2c 100644
|
||||
index 6dd7273..002d94e 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -248,49 +248,32 @@
|
||||
@ -998,8 +1012,6 @@ index 6dd7273..ba07b2c 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1014,7 +1026,8 @@ index 6dd7273..ba07b2c 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1028,9 +1041,8 @@ index 6dd7273..ba07b2c 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index a92ca95..e23b74f 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index a1002fd..3a00ffe 100644
|
||||
index a1002fd..292afd0 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index a1002fd..3a00ffe 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index a1002fd..3a00ffe 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
@@ -239,7 +228,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +233,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +255,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +261,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
let amt = (&mut self.inner[(pos as usize)..]).write(buf)?;
|
||||
diff --git a/error.rs b/error.rs
|
||||
index e142c78..eeb11d5 100644
|
||||
--- a/error.rs
|
||||
@ -968,7 +982,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index a058337..d190cba 100644
|
||||
index a058337..b8439a9 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,49 +247,32 @@
|
||||
@ -998,8 +1012,6 @@ index a058337..d190cba 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1014,7 +1026,8 @@ index a058337..d190cba 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1028,9 +1041,8 @@ index a058337..d190cba 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index 632ef3d..dd63ebe 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index a1002fd..3a00ffe 100644
|
||||
index a1002fd..292afd0 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index a1002fd..3a00ffe 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index a1002fd..3a00ffe 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
@@ -239,7 +228,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +233,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +255,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +261,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
let amt = (&mut self.inner[(pos as usize)..]).write(buf)?;
|
||||
diff --git a/error.rs b/error.rs
|
||||
index 9a605fc..d3d0814 100644
|
||||
--- a/error.rs
|
||||
@ -968,7 +982,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index d914d14..d17f3cf 100644
|
||||
index d914d14..708e8bf 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -248,49 +248,32 @@
|
||||
@ -998,8 +1012,6 @@ index d914d14..d17f3cf 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1014,7 +1026,8 @@ index d914d14..d17f3cf 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1028,9 +1041,8 @@ index d914d14..d17f3cf 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index a92ca95..e23b74f 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 2d78055..1db50ee 100644
|
||||
index 2d78055..a269a7c 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index 2d78055..1db50ee 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index 2d78055..1db50ee 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -240,7 +229,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -240,7 +234,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -268,7 +256,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -268,8 +262,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index e142c78..eeb11d5 100644
|
||||
--- a/error.rs
|
||||
@ -968,7 +982,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index a058337..d190cba 100644
|
||||
index a058337..b8439a9 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,49 +247,32 @@
|
||||
@ -998,8 +1012,6 @@ index a058337..d190cba 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1014,7 +1026,8 @@ index a058337..d190cba 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1028,9 +1041,8 @@ index a058337..d190cba 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index 632ef3d..dd63ebe 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index a1002fd..3a00ffe 100644
|
||||
index a1002fd..292afd0 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index a1002fd..3a00ffe 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index a1002fd..3a00ffe 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
@@ -239,7 +228,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +233,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +255,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +261,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
let amt = (&mut self.inner[(pos as usize)..]).write(buf)?;
|
||||
diff --git a/error.rs b/error.rs
|
||||
index 9a605fc..d3d0814 100644
|
||||
--- a/error.rs
|
||||
@ -968,7 +982,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index bcce8ee..4a492d7 100644
|
||||
index bcce8ee..d56de11 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -248,49 +248,32 @@
|
||||
@ -998,8 +1012,6 @@ index bcce8ee..4a492d7 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1014,7 +1026,8 @@ index bcce8ee..4a492d7 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1028,9 +1041,8 @@ index bcce8ee..4a492d7 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index 632ef3d..dd63ebe 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index a1002fd..3a00ffe 100644
|
||||
index a1002fd..292afd0 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index a1002fd..3a00ffe 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index a1002fd..3a00ffe 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
@@ -239,7 +228,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +233,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +255,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +261,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
let amt = (&mut self.inner[(pos as usize)..]).write(buf)?;
|
||||
diff --git a/error.rs b/error.rs
|
||||
index 9a605fc..d3d0814 100644
|
||||
--- a/error.rs
|
||||
@ -968,7 +982,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 28492b3..924d626 100644
|
||||
index 28492b3..aafb081 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -248,49 +248,32 @@
|
||||
@ -998,8 +1012,6 @@ index 28492b3..924d626 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1014,7 +1026,8 @@ index 28492b3..924d626 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1028,9 +1041,8 @@ index 28492b3..924d626 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -282,7 +282,7 @@ index 93b2d34..47282c9 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index ae0085f..5392880 100644
|
||||
index ae0085f..0f8029d 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,11 @@
|
||||
@ -292,8 +292,9 @@ index ae0085f..5392880 100644
|
||||
+use core::prelude::v1::*;
|
||||
use io::prelude::*;
|
||||
|
||||
use core::convert::TryInto;
|
||||
-use core::convert::TryInto;
|
||||
-use cmp;
|
||||
+#[cfg(feature = "collections")] use core::convert::TryInto;
|
||||
+use core::cmp;
|
||||
use io::{self, SeekFrom, Error, ErrorKind};
|
||||
|
||||
@ -358,23 +359,33 @@ index ae0085f..5392880 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +203,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +203,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +211,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +219,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -382,22 +393,26 @@ index ae0085f..5392880 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -240,7 +230,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -240,7 +235,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos: usize = self.position().try_into().map_err(|_| {
|
||||
@@ -270,7 +259,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -270,8 +265,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index ddf0030..748b830 100644
|
||||
--- a/error.rs
|
||||
@ -883,7 +898,7 @@ index 3824a5f..312cf47 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 7310564..05d91fc 100644
|
||||
index 7310564..0fafc60 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,42 +247,32 @@
|
||||
@ -906,8 +921,6 @@ index 7310564..05d91fc 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -922,7 +935,8 @@ index 7310564..05d91fc 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -936,9 +950,8 @@ index 7310564..05d91fc 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index 632ef3d..dd63ebe 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index a1002fd..3a00ffe 100644
|
||||
index a1002fd..292afd0 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index a1002fd..3a00ffe 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index a1002fd..3a00ffe 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
@@ -239,7 +228,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +233,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +255,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +261,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
let amt = (&mut self.inner[(pos as usize)..]).write(buf)?;
|
||||
diff --git a/error.rs b/error.rs
|
||||
index e142c78..eeb11d5 100644
|
||||
--- a/error.rs
|
||||
@ -968,7 +982,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index a058337..d190cba 100644
|
||||
index a058337..b8439a9 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,49 +247,32 @@
|
||||
@ -998,8 +1012,6 @@ index a058337..d190cba 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1014,7 +1026,8 @@ index a058337..d190cba 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1028,9 +1041,8 @@ index a058337..d190cba 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index a92ca95..e23b74f 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 2d78055..1db50ee 100644
|
||||
index 2d78055..a269a7c 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index 2d78055..1db50ee 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index 2d78055..1db50ee 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -240,7 +229,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -240,7 +234,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -268,7 +256,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -268,8 +262,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index 05ae8ed..5da1224 100644
|
||||
--- a/error.rs
|
||||
@ -974,7 +988,7 @@ index a408b43..823a3ad 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index d5b255e..c14c50e 100644
|
||||
index d5b255e..33502d5 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,49 +247,32 @@
|
||||
@ -1004,8 +1018,6 @@ index d5b255e..c14c50e 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1020,7 +1032,8 @@ index d5b255e..c14c50e 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1034,9 +1047,8 @@ index d5b255e..c14c50e 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index a92ca95..e23b74f 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 2d78055..1db50ee 100644
|
||||
index 2d78055..a269a7c 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index 2d78055..1db50ee 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index 2d78055..1db50ee 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -240,7 +229,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -240,7 +234,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -268,7 +256,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -268,8 +262,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index 05ae8ed..5da1224 100644
|
||||
--- a/error.rs
|
||||
@ -974,7 +988,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index a058337..d190cba 100644
|
||||
index a058337..b8439a9 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,49 +247,32 @@
|
||||
@ -1004,8 +1018,6 @@ index a058337..d190cba 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1020,7 +1032,8 @@ index a058337..d190cba 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1034,9 +1047,8 @@ index a058337..d190cba 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -282,7 +282,7 @@ index a26a932..83ea558 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 1b836b7..c77f287 100644
|
||||
index 1b836b7..4840c92 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,9 +8,10 @@
|
||||
@ -357,23 +357,33 @@ index 1b836b7..c77f287 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -209,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -209,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -218,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -227,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -381,22 +391,26 @@ index 1b836b7..c77f287 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -239,7 +229,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +234,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +256,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +262,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index d90be2e..d23baa8 100644
|
||||
--- a/error.rs
|
||||
@ -973,7 +987,7 @@ index a408b43..823a3ad 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 1053792..5acfe6a 100644
|
||||
index 1053792..ae6a3c7 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,42 +247,32 @@
|
||||
@ -996,8 +1010,6 @@ index 1053792..5acfe6a 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1012,7 +1024,8 @@ index 1053792..5acfe6a 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1026,9 +1039,8 @@ index 1053792..5acfe6a 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index 632ef3d..dd63ebe 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index a1002fd..3a00ffe 100644
|
||||
index a1002fd..292afd0 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index a1002fd..3a00ffe 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index a1002fd..3a00ffe 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
@@ -239,7 +228,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +233,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +255,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +261,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
let amt = (&mut self.inner[(pos as usize)..]).write(buf)?;
|
||||
diff --git a/error.rs b/error.rs
|
||||
index 9a605fc..d3d0814 100644
|
||||
--- a/error.rs
|
||||
@ -968,7 +982,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index a058337..d190cba 100644
|
||||
index a058337..b8439a9 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,49 +247,32 @@
|
||||
@ -998,8 +1012,6 @@ index a058337..d190cba 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1014,7 +1026,8 @@ index a058337..d190cba 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1028,9 +1041,8 @@ index a058337..d190cba 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index 632ef3d..dd63ebe 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index a1002fd..3a00ffe 100644
|
||||
index a1002fd..292afd0 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index a1002fd..3a00ffe 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index a1002fd..3a00ffe 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
@@ -239,7 +228,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +233,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +255,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +261,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
let amt = (&mut self.inner[(pos as usize)..]).write(buf)?;
|
||||
diff --git a/error.rs b/error.rs
|
||||
index 9a605fc..d3d0814 100644
|
||||
--- a/error.rs
|
||||
@ -968,7 +982,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index ca15aa2..900ee2f 100644
|
||||
index ca15aa2..70879e5 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -248,49 +248,32 @@
|
||||
@ -998,8 +1012,6 @@ index ca15aa2..900ee2f 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1014,7 +1026,8 @@ index ca15aa2..900ee2f 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1028,9 +1041,8 @@ index ca15aa2..900ee2f 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index 08877fe..a1af9d9 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 420fede..670e362 100644
|
||||
index 420fede..d4242f7 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index 420fede..670e362 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = try!(Read::read(&mut try!(self.fill_buf()), buf));
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = try!(Read::read(&mut try!(self.fill_buf()), buf));
|
||||
+ let n = try!(Read::read(&mut try!(self.get_buf()), buf));
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index 420fede..670e362 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
@@ -239,7 +228,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +233,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +255,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +261,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
let amt = try!((&mut self.inner[(pos as usize)..]).write(buf));
|
||||
diff --git a/error.rs b/error.rs
|
||||
index e3f17c8..50e3658 100644
|
||||
--- a/error.rs
|
||||
@ -976,7 +990,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 61334f3..9d9263f 100644
|
||||
index 61334f3..26b9102 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -248,49 +248,32 @@
|
||||
@ -1006,8 +1020,6 @@ index 61334f3..9d9263f 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1022,7 +1034,8 @@ index 61334f3..9d9263f 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1036,9 +1049,8 @@ index 61334f3..9d9263f 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index a92ca95..e23b74f 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index a1002fd..3a00ffe 100644
|
||||
index a1002fd..292afd0 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index a1002fd..3a00ffe 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index a1002fd..3a00ffe 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
@@ -239,7 +228,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +233,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +255,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +261,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
let amt = (&mut self.inner[(pos as usize)..]).write(buf)?;
|
||||
diff --git a/error.rs b/error.rs
|
||||
index e142c78..eeb11d5 100644
|
||||
--- a/error.rs
|
||||
@ -968,7 +982,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index a058337..d190cba 100644
|
||||
index a058337..b8439a9 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,49 +247,32 @@
|
||||
@ -998,8 +1012,6 @@ index a058337..d190cba 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1014,7 +1026,8 @@ index a058337..d190cba 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1028,9 +1041,8 @@ index a058337..d190cba 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index 08877fe..a1af9d9 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 420fede..670e362 100644
|
||||
index 420fede..d4242f7 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index 420fede..670e362 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = try!(Read::read(&mut try!(self.fill_buf()), buf));
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = try!(Read::read(&mut try!(self.fill_buf()), buf));
|
||||
+ let n = try!(Read::read(&mut try!(self.get_buf()), buf));
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index 420fede..670e362 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
@@ -239,7 +228,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +233,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +255,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +261,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
let amt = try!((&mut self.inner[(pos as usize)..]).write(buf));
|
||||
diff --git a/error.rs b/error.rs
|
||||
index 9a605fc..d3d0814 100644
|
||||
--- a/error.rs
|
||||
@ -968,7 +982,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 60a720e..85ce207 100644
|
||||
index 60a720e..b6b24ea 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -248,49 +248,32 @@
|
||||
@ -998,8 +1012,6 @@ index 60a720e..85ce207 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1014,7 +1026,8 @@ index 60a720e..85ce207 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1028,9 +1041,8 @@ index 60a720e..85ce207 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -282,7 +282,7 @@ index 21a0cc1..27c5ac1 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 1b836b7..c77f287 100644
|
||||
index 1b836b7..4840c92 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,9 +8,10 @@
|
||||
@ -357,23 +357,33 @@ index 1b836b7..c77f287 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -209,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -209,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -218,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -227,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -381,22 +391,26 @@ index 1b836b7..c77f287 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -239,7 +229,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +234,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +256,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +262,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index ddf0030..748b830 100644
|
||||
--- a/error.rs
|
||||
@ -882,7 +896,7 @@ index 3824a5f..312cf47 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 3becc0a..05d91fc 100644
|
||||
index 3becc0a..0fafc60 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,42 +247,32 @@
|
||||
@ -905,8 +919,6 @@ index 3becc0a..05d91fc 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -921,7 +933,8 @@ index 3becc0a..05d91fc 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -935,9 +948,8 @@ index 3becc0a..05d91fc 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index a92ca95..e23b74f 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 2d78055..1db50ee 100644
|
||||
index 2d78055..a269a7c 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index 2d78055..1db50ee 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index 2d78055..1db50ee 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -240,7 +229,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -240,7 +234,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -268,7 +256,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -268,8 +262,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index 05ae8ed..5da1224 100644
|
||||
--- a/error.rs
|
||||
@ -974,7 +988,7 @@ index a408b43..823a3ad 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index a058337..d190cba 100644
|
||||
index a058337..b8439a9 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,49 +247,32 @@
|
||||
@ -1004,8 +1018,6 @@ index a058337..d190cba 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1020,7 +1032,8 @@ index a058337..d190cba 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1034,9 +1047,8 @@ index a058337..d190cba 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -282,7 +282,7 @@ index dbb45d5..a138b3e 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 1b836b7..c77f287 100644
|
||||
index 1b836b7..4840c92 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,9 +8,10 @@
|
||||
@ -357,23 +357,33 @@ index 1b836b7..c77f287 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -209,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -209,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -218,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -227,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -381,22 +391,26 @@ index 1b836b7..c77f287 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -239,7 +229,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +234,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +256,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +262,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index ddf0030..748b830 100644
|
||||
--- a/error.rs
|
||||
@ -974,7 +988,7 @@ index 03f55f7..f767e0c 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 06609cf..a1bbe50 100644
|
||||
index 06609cf..106cf67 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,42 +247,32 @@
|
||||
@ -997,8 +1011,6 @@ index 06609cf..a1bbe50 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1013,7 +1025,8 @@ index 06609cf..a1bbe50 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1027,9 +1040,8 @@ index 06609cf..a1bbe50 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index a92ca95..e23b74f 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 2d78055..1db50ee 100644
|
||||
index 2d78055..a269a7c 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index 2d78055..1db50ee 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index 2d78055..1db50ee 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -240,7 +229,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -240,7 +234,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -268,7 +256,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -268,8 +262,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index e142c78..eeb11d5 100644
|
||||
--- a/error.rs
|
||||
@ -968,7 +982,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index a058337..d190cba 100644
|
||||
index a058337..b8439a9 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,49 +247,32 @@
|
||||
@ -998,8 +1012,6 @@ index a058337..d190cba 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1014,7 +1026,8 @@ index a058337..d190cba 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1028,9 +1041,8 @@ index a058337..d190cba 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -282,7 +282,7 @@ index 4ff8c6a..fd4eb13 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 1b836b7..c77f287 100644
|
||||
index 1b836b7..4840c92 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,9 +8,10 @@
|
||||
@ -357,23 +357,33 @@ index 1b836b7..c77f287 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -209,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -209,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -218,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -227,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -381,22 +391,26 @@ index 1b836b7..c77f287 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -239,7 +229,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +234,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +256,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +262,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index ddf0030..748b830 100644
|
||||
--- a/error.rs
|
||||
@ -974,7 +988,7 @@ index 03f55f7..f767e0c 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 06609cf..a1bbe50 100644
|
||||
index 06609cf..106cf67 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,42 +247,32 @@
|
||||
@ -997,8 +1011,6 @@ index 06609cf..a1bbe50 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1013,7 +1025,8 @@ index 06609cf..a1bbe50 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1027,9 +1040,8 @@ index 06609cf..a1bbe50 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index a92ca95..e23b74f 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 2d78055..1db50ee 100644
|
||||
index 2d78055..a269a7c 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index 2d78055..1db50ee 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index 2d78055..1db50ee 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -240,7 +229,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -240,7 +234,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -268,7 +256,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -268,8 +262,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index 5333b0a..25bbd8b 100644
|
||||
--- a/error.rs
|
||||
@ -982,7 +996,7 @@ index a408b43..823a3ad 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 307d014..3f9472c 100644
|
||||
index 307d014..c9f84fb 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,49 +247,32 @@
|
||||
@ -1012,8 +1026,6 @@ index 307d014..3f9472c 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1028,7 +1040,8 @@ index 307d014..3f9472c 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1042,9 +1055,8 @@ index 307d014..3f9472c 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index ccebf36..17e6955 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 420fede..670e362 100644
|
||||
index 420fede..d4242f7 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index 420fede..670e362 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = try!(Read::read(&mut try!(self.fill_buf()), buf));
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = try!(Read::read(&mut try!(self.fill_buf()), buf));
|
||||
+ let n = try!(Read::read(&mut try!(self.get_buf()), buf));
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index 420fede..670e362 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
@@ -239,7 +228,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -239,7 +233,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -267,7 +255,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -267,8 +261,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
let amt = try!((&mut self.inner[(pos as usize)..]).write(buf));
|
||||
diff --git a/error.rs b/error.rs
|
||||
index e3f17c8..50e3658 100644
|
||||
--- a/error.rs
|
||||
@ -976,7 +990,7 @@ index 1d97611..110cfac 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 61334f3..9d9263f 100644
|
||||
index 61334f3..26b9102 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -248,49 +248,32 @@
|
||||
@ -1006,8 +1020,6 @@ index 61334f3..9d9263f 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1022,7 +1034,8 @@ index 61334f3..9d9263f 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1036,9 +1049,8 @@ index 61334f3..9d9263f 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -283,7 +283,7 @@ index a92ca95..e23b74f 100644
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("LineWriter")
|
||||
diff --git a/cursor.rs b/cursor.rs
|
||||
index 2d78055..1db50ee 100644
|
||||
index 2d78055..a269a7c 100644
|
||||
--- a/cursor.rs
|
||||
+++ b/cursor.rs
|
||||
@@ -8,10 +8,10 @@
|
||||
@ -359,23 +359,33 @@ index 2d78055..1db50ee 100644
|
||||
impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn seek(&mut self, style: SeekFrom) -> io::Result<u64> {
|
||||
let pos = match style {
|
||||
@@ -210,7 +202,6 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
@@ -210,25 +202,27 @@ impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
@@ -219,7 +210,6 @@ impl<T> Read for Cursor<T> where T: AsRef<[u8]> {
|
||||
- let n = Read::read(&mut self.fill_buf()?, buf)?;
|
||||
+ let n = Read::read(&mut self.get_buf()?, buf)?;
|
||||
self.pos += n as u64;
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
-impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
- fn fill_buf(&mut self) -> io::Result<&[u8]> {
|
||||
+impl<T> Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn get_buf(&mut self) -> io::Result<&[u8]> {
|
||||
let amt = cmp::min(self.pos, self.inner.as_ref().len() as u64);
|
||||
@@ -228,7 +218,6 @@ impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
Ok(&self.inner.as_ref()[(amt as usize)..])
|
||||
}
|
||||
+}
|
||||
+
|
||||
+#[cfg(feature = "collections")]
|
||||
+impl<T> BufRead for Cursor<T> where T: AsRef<[u8]> {
|
||||
+ fn fill_buf(&mut self) -> io::Result<&[u8]> { self.get_buf() }
|
||||
fn consume(&mut self, amt: usize) { self.pos += amt as u64; }
|
||||
}
|
||||
|
||||
@ -383,22 +393,26 @@ index 2d78055..1db50ee 100644
|
||||
impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
#[inline]
|
||||
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
|
||||
@@ -240,7 +229,6 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
@@ -240,7 +234,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+#[cfg(feature = "collections")]
|
||||
impl Write for Cursor<Vec<u8>> {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
// Make sure the internal buffer is as least as big as where we
|
||||
@@ -268,7 +256,6 @@ impl Write for Cursor<Vec<u8>> {
|
||||
@@ -268,8 +262,8 @@ impl Write for Cursor<Vec<u8>> {
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
|
||||
-#[stable(feature = "cursor_box_slice", since = "1.5.0")]
|
||||
impl Write for Cursor<Box<[u8]>> {
|
||||
-impl Write for Cursor<Box<[u8]>> {
|
||||
+#[cfg(feature = "alloc")]
|
||||
+impl Write for Cursor<::alloc::boxed::Box<[u8]>> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
let pos = cmp::min(self.pos, self.inner.len() as u64);
|
||||
diff --git a/error.rs b/error.rs
|
||||
index 5333b0a..25bbd8b 100644
|
||||
--- a/error.rs
|
||||
@ -982,7 +996,7 @@ index a408b43..823a3ad 100644
|
||||
const LO_U64: u64 = 0x0101010101010101;
|
||||
const HI_U64: u64 = 0x8080808080808080;
|
||||
diff --git a/mod.rs b/mod.rs
|
||||
index 88fd418..94508d2 100644
|
||||
index 88fd418..5c487a6 100644
|
||||
--- a/mod.rs
|
||||
+++ b/mod.rs
|
||||
@@ -247,49 +247,32 @@
|
||||
@ -1012,8 +1026,6 @@ index 88fd418..94508d2 100644
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::buffered::IntoInnerError;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
-pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
+use core::fmt;
|
||||
+use core::iter::{Iterator};
|
||||
+use core::marker::Sized;
|
||||
@ -1028,7 +1040,8 @@ index 88fd418..94508d2 100644
|
||||
+
|
||||
+#[cfg(feature="collections")] pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
+#[cfg(feature="collections")] pub use self::buffered::IntoInnerError;
|
||||
+#[cfg(feature="collections")] pub use self::cursor::Cursor;
|
||||
pub use self::cursor::Cursor;
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::error::{Result, Error, ErrorKind};
|
||||
-#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
|
||||
@ -1042,9 +1055,8 @@ index 88fd418..94508d2 100644
|
||||
|
||||
pub mod prelude;
|
||||
-mod buffered;
|
||||
-mod cursor;
|
||||
+#[cfg(feature="collections")] mod buffered;
|
||||
+#[cfg(feature="collections")] mod cursor;
|
||||
mod cursor;
|
||||
mod error;
|
||||
mod impls;
|
||||
-mod lazy;
|
||||
|
@ -3,7 +3,7 @@
|
||||
//! the [std documentation](https://doc.rust-lang.org/nightly/std/io/index.html)
|
||||
//! for a full description of the functionality.
|
||||
#![allow(stable_features,unused_features)]
|
||||
#![feature(question_mark,const_fn,collections,alloc,unicode,copy_from_slice,str_char)]
|
||||
#![feature(question_mark,const_fn,collections,alloc,unicode,copy_from_slice,str_char,try_from)]
|
||||
#![no_std]
|
||||
|
||||
#[cfg_attr(feature="collections",macro_use)]
|
||||
|
Loading…
Reference in New Issue
Block a user