From 22e51cd78a81b5dc9be915f975c6c05721fe5797 Mon Sep 17 00:00:00 2001 From: Charles Lew Date: Fri, 17 Apr 2020 21:10:48 +0800 Subject: [PATCH] Implement `Clone` for `liballoc::collections::linked_list::Cursor`. --- src/liballoc/collections/linked_list.rs | 8 ++++++++ 1 file changed, 8 insertions(+) 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 @@ -1197,6 +1197,14 @@ pub struct Cursor<'a, T: 'a> { list: &'a LinkedList, } +#[unstable(feature = "linked_list_cursors", issue = "58533")] +impl 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 fmt::Debug for Cursor<'_, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {