From 78571d3b489c6a92581e767f553c6a0d9f54878b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AF=A7=E9=9D=9C?= Date: Thu, 19 Dec 2019 13:38:33 +0800 Subject: [PATCH] Update cursor.rs --- src/libstd/io/cursor.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs index a94176e710005..5ece7eb7af7a5 100644 --- a/src/libstd/io/cursor.rs +++ b/src/libstd/io/cursor.rs @@ -391,6 +391,23 @@ impl Write for Cursor> { fn flush(&mut self) -> io::Result<()> { Ok(()) } } + +#[stable(feature = "rust1", since = "1.0.0")] +impl> Write for Cursor { + #[inline] + fn write(&mut self, buf: &[u8]) -> io::Result { + self.inner.as_mut().write(buf) + } + + #[inline] + fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result { + self.inner.as_mut().write_vectored(bufs) + } + + #[inline] + fn flush(&mut self) -> io::Result<()> { Ok(()) } +} + #[cfg(test)] mod tests { use crate::io::prelude::*;