about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/alloc/src/collections/binary_heap/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/library/alloc/src/collections/binary_heap/mod.rs b/library/alloc/src/collections/binary_heap/mod.rs
index abc29b32bbc..9c2588c26b4 100644
--- a/library/alloc/src/collections/binary_heap/mod.rs
+++ b/library/alloc/src/collections/binary_heap/mod.rs
@@ -1245,6 +1245,13 @@ impl<T, A: Allocator> BinaryHeap<T, A> {
         self.into()
     }
 
+    /// Returns a reference to the underlying allocator.
+    #[unstable(feature = "allocator_api", issue = "32838")]
+    #[inline]
+    pub fn allocator(&self) -> &A {
+        self.data.allocator()
+    }
+
     /// Returns the length of the binary heap.
     ///
     /// # Examples