From d3b8a64d98faa9c7dc5bb4b6a6a517ef1b51db37 Mon Sep 17 00:00:00 2001 From: Jose Narvaez Date: Fri, 6 Dec 2024 17:28:49 +0000 Subject: [PATCH] Review Suggestion: Make rbasic_class return Option>. --- crates/rb-sys/src/stable_api.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/rb-sys/src/stable_api.rs b/crates/rb-sys/src/stable_api.rs index 418061bb..204c9da3 100644 --- a/crates/rb-sys/src/stable_api.rs +++ b/crates/rb-sys/src/stable_api.rs @@ -12,7 +12,10 @@ //! changes in production. use crate::VALUE; -use std::os::raw::{c_char, c_long}; +use std::{ + os::raw::{c_char, c_long}, + ptr::NonNull, +}; pub trait StableApiDefinition { const VERSION_MAJOR: u32; @@ -60,7 +63,7 @@ pub trait StableApiDefinition { /// This function is unsafe because it dereferences a raw pointer to get /// access to underlying RBasic struct. The caller must ensure that the /// `VALUE` is a valid pointer to a non-immediate object. - unsafe fn rbasic_class(&self, obj: VALUE) -> VALUE; + unsafe fn rbasic_class(&self, obj: VALUE) -> Option>; /// Checks if the given object is frozen. ///