Check that a pointer is non-null, returning an error if it is.
(ptr: *const T, name: &str)
| 108 | |
| 109 | /// Check that a pointer is non-null, returning an error if it is. |
| 110 | pub fn check_non_null<T>(ptr: *const T, name: &str) -> Result<(), *mut paimon_error> { |
| 111 | if ptr.is_null() { |
| 112 | Err(paimon_error::new( |
| 113 | PaimonErrorCode::InvalidInput, |
| 114 | format!("null pointer passed for `{name}`"), |
| 115 | )) |
| 116 | } else { |
| 117 | Ok(()) |
| 118 | } |
| 119 | } |
no test coverage detected