pub trait RPartialOrd {
// Required method
fn r_partial_cmp(&self, other: &Self) -> Option<i32>;
// Provided method
#[doc(hidden)] unsafe extern "C" fn __RPartialOrd_r_partial_cmp_shim(
data: *mut c_void,
argc: i32,
argv: *const SEXP,
) -> SEXP
where Self: Sized + RPartialOrd + TypedExternal + Send + 'static { ... }
}Expand description
Adapter trait for std::cmp::PartialOrd.
Provides partial ordering comparison for R, handling incomparable values.
Automatically implemented for any type that implements PartialOrd.
§Methods
r_partial_cmp(&self, other: &Self)(partial_cmp()in R) - Returns Some(-1/0/1) or None
§Example
ⓘ
// f64 has partial ordering (NaN is not comparable)
#[derive(PartialOrd, PartialEq, ExternalPtr)]
struct MyFloat(f64);
#[miniextendr]
impl miniextendr_api::adapter_traits::RPartialOrd for MyFloat {}Required Methods§
Sourcefn r_partial_cmp(&self, other: &Self) -> Option<i32>
fn r_partial_cmp(&self, other: &Self) -> Option<i32>
Compare with another value, returning None if incomparable.
Returns:
Some(-1)ifself < otherSome(0)ifself == otherSome(1)ifself > otherNoneif values are incomparable (in R,NA)
Provided Methods§
Source#[doc(hidden)]unsafe extern "C" fn __RPartialOrd_r_partial_cmp_shim(
data: *mut c_void,
argc: i32,
argv: *const SEXP,
) -> SEXP
#[doc(hidden)]unsafe extern "C" fn __RPartialOrd_r_partial_cmp_shim(
data: *mut c_void,
argc: i32,
argv: *const SEXP,
) -> SEXP
Method shim for RPartialOrd::r_partial_cmp.
Converts SEXP arguments, calls the method, and returns SEXP result.
Both Rust panics and R longjmps are caught via with_r_unwind_protect.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".