// Copyright 2025 Jonas Kruckenberg // // Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be // copied, modified, or distributed except according to those terms. use core::ptr::NonNull; pub mod atomic_cell; pub mod either; pub mod zip_eq; /// Helper to construct a `NonNull` from a raw pointer to `T`, with null /// checks elided in release mode. #[cfg(debug_assertions)] #[track_caller] #[inline(always)] pub(crate) unsafe fn non_null(ptr: *mut T) -> NonNull { NonNull::new(ptr).expect( "/!\\ constructed a `NonNull` from a null pointer! /!\\ \n\ in release mode, this would have called `NonNull::new_unchecked`, \ violating the `NonNull` invariant!", ) } /// Helper to construct a `NonNull` from a raw pointer to `T`, with null /// checks elided in release mode. /// /// This is the release mode version. #[cfg(not(debug_assertions))] #[inline(always)] pub(crate) unsafe fn non_null(ptr: *mut T) -> NonNull { // Safety: ensured by caller unsafe { NonNull::new_unchecked(ptr) } }