Skip to content

Commit 554ea57

Browse files
authored
Merge pull request #46 from fitzgen/inner-allocator-getter
Add an accessor for the `Allocator` that a `Dlmalloc` was constructed with
2 parents b8f84fa + 64cb606 commit 554ea57

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/dlmalloc.rs

+4
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ impl<A> Dlmalloc<A> {
130130
system_allocator,
131131
}
132132
}
133+
134+
pub fn allocator(&self) -> &A {
135+
&self.system_allocator
136+
}
133137
}
134138

135139
impl<A: Allocator> Dlmalloc<A> {

src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,10 @@ impl<A: Allocator> Dlmalloc<A> {
206206
pub unsafe fn destroy(self) -> usize {
207207
self.0.destroy()
208208
}
209+
210+
/// Get a reference the underlying [`Allocator`] that this `Dlmalloc` was
211+
/// constructed with.
212+
pub fn allocator(&self) -> &A {
213+
self.0.allocator()
214+
}
209215
}

0 commit comments

Comments
 (0)