Skip to content

Commit 259ddec

Browse files
committed
impl thin::SizeOf{,Debug} for allocator::adapt::AllocZst - for once, an non-buggy allocator. So far.
1 parent aa98c2a commit 259ddec

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/allocator/adapt/alloc_zst.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ unsafe impl<A: thin::Realloc> thin::Realloc for AllocZst<A> {
8686
}
8787
}
8888

89+
unsafe impl<A: thin::SizeOf> thin::SizeOf for AllocZst<A> {
90+
unsafe fn size_of(&self, ptr: NonNull<MaybeUninit<u8>>) -> usize {
91+
unsafe { self.0.size_of(ptr) }
92+
}
93+
}
94+
95+
unsafe impl<A: thin::SizeOfDebug> thin::SizeOfDebug for AllocZst<A> {
96+
unsafe fn size_of_debug(&self, ptr: NonNull<MaybeUninit<u8>>) -> Option<usize> {
97+
unsafe { self.0.size_of_debug(ptr) }
98+
}
99+
}
100+
89101

90102

91103
// fat::*

0 commit comments

Comments
 (0)