pub trait RPartialOrd {
// Required method
fn partial_cmp(&self, other: &Self) -> Option<i32>;
}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
partial_cmp(&self, other: &Self)- 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 RPartialOrd for MyFloat {}Required Methods§
Sourcefn partial_cmp(&self, other: &Self) -> Option<i32>
fn 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 (maps to NA in R)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.