diff options
| author | Luro02 <24826124+Luro02@users.noreply.github.com> | 2019-12-11 17:59:32 +0100 |
|---|---|---|
| committer | Luro02 <24826124+Luro02@users.noreply.github.com> | 2019-12-22 10:39:58 +0100 |
| commit | 89986a39a8236a3e4bfbb74b4d3a0a03667e8b56 (patch) | |
| tree | a5a2720e751bb614fba6521ddcf2ef15c24789a3 /src/libstd | |
| parent | 90b957a17c1abba979aa41234ce0993a61030e67 (diff) | |
| download | rust-89986a39a8236a3e4bfbb74b4d3a0a03667e8b56.tar.gz rust-89986a39a8236a3e4bfbb74b4d3a0a03667e8b56.zip | |
add partialeq and eq to cursor
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io/cursor.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs index a94176e7100..1cdedd859d3 100644 --- a/src/libstd/io/cursor.rs +++ b/src/libstd/io/cursor.rs @@ -72,7 +72,7 @@ use core::convert::TryInto; /// } /// ``` #[stable(feature = "rust1", since = "1.0.0")] -#[derive(Clone, Debug, Default)] +#[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct Cursor<T> { inner: T, pos: u64, @@ -902,4 +902,16 @@ mod tests { c.set_position(<usize>::max_value() as u64 + 1); assert!(c.write_all(&[1, 2, 3]).is_err()); } + + #[test] + fn test_partial_eq() { + assert_eq!(Cursor::new(Vec::<u8>::new()), Cursor::new(Vec::<u8>::new())); + } + + #[test] + fn test_eq() { + struct AssertEq<T: Eq>(pub T); + + let _: AssertEq<Cursor<Vec<u8>>> = AssertEq(Cursor::new(Vec::new())); + } } |
