diff options
| author | Charles Lew <crlf0710@gmail.com> | 2020-04-17 21:10:48 +0800 |
|---|---|---|
| committer | Charles Lew <crlf0710@gmail.com> | 2020-04-17 21:31:59 +0800 |
| commit | 22e51cd78a81b5dc9be915f975c6c05721fe5797 (patch) | |
| tree | 7524d2c62f6a52cda54fda32cc9bc94d105dea9a /src/liballoc | |
| parent | 861996e13820a2e401df60756a373606b50948e5 (diff) | |
| download | rust-22e51cd78a81b5dc9be915f975c6c05721fe5797.tar.gz rust-22e51cd78a81b5dc9be915f975c6c05721fe5797.zip | |
Implement `Clone` for `liballoc::collections::linked_list::Cursor`.
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/collections/linked_list.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs index 53d4f7239b7..243ebb453d3 100644 --- a/src/liballoc/collections/linked_list.rs +++ b/src/liballoc/collections/linked_list.rs @@ -1198,6 +1198,14 @@ pub struct Cursor<'a, T: 'a> { } #[unstable(feature = "linked_list_cursors", issue = "58533")] +impl<T> Clone for Cursor<'_, T> { + fn clone(&self) -> Self { + let Cursor { index, current, list } = *self; + Cursor { index, current, list } + } +} + +#[unstable(feature = "linked_list_cursors", issue = "58533")] impl<T: fmt::Debug> fmt::Debug for Cursor<'_, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_tuple("Cursor").field(&self.list).field(&self.index()).finish() |
