Skip to content

Commit

Permalink
Review Suggestion: Make rbasic_class return Option<NonNull>>.
Browse files Browse the repository at this point in the history
  • Loading branch information
goyox86 committed Dec 6, 2024
1 parent d6f7f13 commit d3b8a64
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/rb-sys/src/stable_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<NonNull<VALUE>>;

/// Checks if the given object is frozen.
///
Expand Down

0 comments on commit d3b8a64

Please sign in to comment.