about summary refs log tree commit diff
diff options
context:
space:
mode:
authoryanchith <yanchi.toth@gmail.com>2023-06-09 11:53:28 +0200
committeryanchith <yanchi.toth@gmail.com>2023-06-09 11:53:28 +0200
commit208da513ccfd042cb2df9ef12d0bc116b7b63304 (patch)
tree16031736d0ff71637073b54e6a3a459ca9792151
parent7a9f282528fe95e160b177b880e06cc5ca2a426a (diff)
downloadrust-208da513ccfd042cb2df9ef12d0bc116b7b63304.tar.gz
rust-208da513ccfd042cb2df9ef12d0bc116b7b63304.zip
Add allocator function
-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