@@ -1492,6 +1492,14 @@ pub struct IntoIter<
14921492 iter : vec:: IntoIter < T , A > ,
14931493}
14941494
1495+ impl < T , A : Allocator > IntoIter < T , A > {
1496+ /// Returns a reference to the underlying allocator.
1497+ #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
1498+ pub fn allocator ( & self ) -> & A {
1499+ self . iter . allocator ( )
1500+ }
1501+ }
1502+
14951503#[ stable( feature = "collection_debug" , since = "1.17.0" ) ]
14961504impl < T : fmt:: Debug , A : Allocator > fmt:: Debug for IntoIter < T , A > {
14971505 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -1581,6 +1589,14 @@ pub struct IntoIterSorted<
15811589 inner : BinaryHeap < T , A > ,
15821590}
15831591
1592+ impl < T , A : Allocator > IntoIterSorted < T , A > {
1593+ /// Returns a reference to the underlying allocator.
1594+ #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
1595+ pub fn allocator ( & self ) -> & A {
1596+ self . inner . allocator ( )
1597+ }
1598+ }
1599+
15841600#[ unstable( feature = "binary_heap_into_iter_sorted" , issue = "59278" ) ]
15851601impl < T : Ord , A : Allocator > Iterator for IntoIterSorted < T , A > {
15861602 type Item = T ;
@@ -1622,6 +1638,14 @@ pub struct Drain<
16221638 iter : vec:: Drain < ' a , T , A > ,
16231639}
16241640
1641+ impl < T , A : Allocator > Drain < ' _ , T , A > {
1642+ /// Returns a reference to the underlying allocator.
1643+ #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
1644+ pub fn allocator ( & self ) -> & A {
1645+ self . iter . allocator ( )
1646+ }
1647+ }
1648+
16251649#[ stable( feature = "drain" , since = "1.6.0" ) ]
16261650impl < T , A : Allocator > Iterator for Drain < ' _ , T , A > {
16271651 type Item = T ;
@@ -1671,6 +1695,14 @@ pub struct DrainSorted<
16711695 inner : & ' a mut BinaryHeap < T , A > ,
16721696}
16731697
1698+ impl < ' a , T : Ord , A : Allocator > DrainSorted < ' a , T , A > {
1699+ /// Returns a reference to the underlying allocator.
1700+ #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
1701+ pub fn allocator ( & self ) -> & A {
1702+ self . inner . allocator ( )
1703+ }
1704+ }
1705+
16741706#[ unstable( feature = "binary_heap_drain_sorted" , issue = "59278" ) ]
16751707impl < ' a , T : Ord , A : Allocator > Drop for DrainSorted < ' a , T , A > {
16761708 /// Removes heap elements in heap order.
0 commit comments