@@ -1492,6 +1492,14 @@ pub struct IntoIter<
1492
1492
iter : vec:: IntoIter < T , A > ,
1493
1493
}
1494
1494
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
+
1495
1503
#[ stable( feature = "collection_debug" , since = "1.17.0" ) ]
1496
1504
impl < T : fmt:: Debug , A : Allocator > fmt:: Debug for IntoIter < T , A > {
1497
1505
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -1581,6 +1589,14 @@ pub struct IntoIterSorted<
1581
1589
inner : BinaryHeap < T , A > ,
1582
1590
}
1583
1591
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
+
1584
1600
#[ unstable( feature = "binary_heap_into_iter_sorted" , issue = "59278" ) ]
1585
1601
impl < T : Ord , A : Allocator > Iterator for IntoIterSorted < T , A > {
1586
1602
type Item = T ;
@@ -1622,6 +1638,14 @@ pub struct Drain<
1622
1638
iter : vec:: Drain < ' a , T , A > ,
1623
1639
}
1624
1640
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
+
1625
1649
#[ stable( feature = "drain" , since = "1.6.0" ) ]
1626
1650
impl < T , A : Allocator > Iterator for Drain < ' _ , T , A > {
1627
1651
type Item = T ;
@@ -1671,6 +1695,14 @@ pub struct DrainSorted<
1671
1695
inner : & ' a mut BinaryHeap < T , A > ,
1672
1696
}
1673
1697
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
+
1674
1706
#[ unstable( feature = "binary_heap_drain_sorted" , issue = "59278" ) ]
1675
1707
impl < ' a , T : Ord , A : Allocator > Drop for DrainSorted < ' a , T , A > {
1676
1708
/// Removes heap elements in heap order.
0 commit comments