@@ -1495,6 +1495,14 @@ impl<'a, T, A: Allocator> Cursor<'a, T, A> { |
|
|
1495 |
1495 |
pub fn back(&self) -> Option<&'a T> { |
1496 |
1496 |
self.list.back() |
1497 |
1497 |
} |
|
1498 |
+ |
|
1499 |
+/// Provides a reference to the cursor's parent list. |
|
1500 |
+ #[must_use] |
|
1501 |
+#[inline(always)] |
|
1502 |
+#[unstable(feature = "linked_list_cursors", issue = "58533")] |
|
1503 |
+pub fn as_list(&self) -> &'a LinkedList<T, A> { |
|
1504 |
+self.list |
|
1505 |
+} |
1498 |
1506 |
} |
1499 |
1507 |
|
1500 |
1508 |
impl<'a, T, A: Allocator> CursorMut<'a, T, A> { |
@@ -1605,6 +1613,18 @@ impl<'a, T, A: Allocator> CursorMut<'a, T, A> { |
|
|
1605 |
1613 |
pub fn as_cursor(&self) -> Cursor<'_, T, A> { |
1606 |
1614 |
Cursor { list: self.list, current: self.current, index: self.index } |
1607 |
1615 |
} |
|
1616 |
+ |
|
1617 |
+/// Provides a read-only reference to the cursor's parent list. |
|
1618 |
+ /// |
|
1619 |
+ /// The lifetime of the returned reference is bound to that of the |
|
1620 |
+ /// `CursorMut`, which means it cannot outlive the `CursorMut` and that the |
|
1621 |
+ /// `CursorMut` is frozen for the lifetime of the reference. |
|
1622 |
+ #[must_use] |
|
1623 |
+#[inline(always)] |
|
1624 |
+#[unstable(feature = "linked_list_cursors", issue = "58533")] |
|
1625 |
+pub fn as_list(&self) -> &LinkedList<T, A> { |
|
1626 |
+self.list |
|
1627 |
+} |
1608 |
1628 |
} |
1609 |
1629 |
|
1610 |
1630 |
// Now the list editing operations |