diff --git a/src/lib.rs b/src/lib.rs index e11f140..a37b5a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,25 +27,7 @@ use error::PointerError; #[cfg(all(feature = "std", feature = "lender"))] mod lender; -#[inline] -fn validate_pointer_is_not_null(pointer: *const T) -> Result<(), PointerError> { - if pointer.is_null() { - log::error!("Using a NULL pointer as an opaque pointer to Rust's data"); - return Err(PointerError::Null); - } - return Ok(()); -} - -#[inline] -fn validate_pointer(pointer: *const T) -> Result<(), PointerError> { - validate_pointer_is_not_null(pointer)?; - #[cfg(all(feature = "std", feature = "lender"))] - if !lender::is_lent(pointer) { - log::error!("Using an invalid pointer as an opaque pointer to Rust's data"); - return Err(PointerError::Invalid); - } - return Ok(()); -} +mod validation; /// Get a heap-allocated raw pointer without ownership. ///