diff options
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/io/cursor.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/library/std/src/io/cursor.rs b/library/std/src/io/cursor.rs index 9021b470065..9527254c947 100644 --- a/library/std/src/io/cursor.rs +++ b/library/std/src/io/cursor.rs @@ -71,7 +71,7 @@ use core::convert::TryInto; /// } /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[derive(Clone, Debug, Default, Eq, PartialEq)] +#[derive(Debug, Default, Eq, PartialEq)] pub struct Cursor<T> { inner: T, pos: u64, @@ -206,6 +206,23 @@ impl<T> Cursor<T> { } #[stable(feature = "rust1", since = "1.0.0")] +impl<T> Clone for Cursor<T> +where + T: Clone, +{ + #[inline] + fn clone(&self) -> Self { + Cursor { inner: self.inner.clone(), pos: self.pos } + } + + #[inline] + fn clone_from(&mut self, other: &Self) { + self.inner.clone_from(&other.inner); + self.pos = other.pos; + } +} + +#[stable(feature = "rust1", since = "1.0.0")] impl<T> io::Seek for Cursor<T> where T: AsRef<[u8]>, |
