From 69053dfbab639197924d960cd5516c8494137e67 Mon Sep 17 00:00:00 2001 From: Cocoa Date: Thu, 27 Jun 2024 22:57:08 +0100 Subject: [PATCH] make `align_alloced_mem_for_struct` public --- rustler/src/resource.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rustler/src/resource.rs b/rustler/src/resource.rs index ff3106ba..58ffd40c 100644 --- a/rustler/src/resource.rs +++ b/rustler/src/resource.rs @@ -109,7 +109,7 @@ fn get_alloc_size_struct() -> usize { /// Given a pointer `ptr` to an allocation of `get_alloc_size_struct::()` bytes, return the /// first aligned pointer within the allocation where a `T` may be stored. /// Unsafe: `ptr` must point to a large enough allocation and not be null. -unsafe fn align_alloced_mem_for_struct(ptr: *const c_void) -> *const c_void { +pub unsafe fn align_alloced_mem_for_struct(ptr: *const c_void) -> *const c_void { let offset = mem::align_of::() - ((ptr as usize) % mem::align_of::()); ptr.add(offset) }