pub fn check_ptr<T>(ptr: *mut T) -> Result<NonNull<T>, Error>
Check a pointer allocated by metatensor-core, returning an error if is null