On Sun, Jun 22, 2025 at 11:12:28PM +0200, Danilo Krummrich wrote: > On Sun, Jun 22, 2025 at 10:47:55PM +0200, Benno Lossin wrote: > > And maybe a closure design is better, depending on how much code is > > usually run in `release`, if it's a lot, then we should use the trait > > design. If it's only 1-5 lines, then a closure would also be fine. I > > don't have a strong preference, but if it's mostly one liners, then > > closures would be better. > > It should usually be rather short, so probably makes sense. Quickly tried how it turns out with a closure: The only way I know to capture the closure within the unsafe extern "C" fn callback<P>(ptr: *mut kernel::ffi::c_void) is with another dynamic allocation, which isn't worth it. Unless there's another way I'm not aware of, I'd keep the Release trait.