Skip to main content

ROrd

Trait ROrd 

Source
pub trait ROrd {
    // Required method
    fn cmp(&self, other: &Self) -> i32;
}
Expand description

Adapter trait for std::cmp::Ord.

Provides total ordering comparison for R sorting operations. Automatically implemented for any type that implements Ord.

§Methods

  • cmp(&self, other: &Self) - Returns -1, 0, or 1

§Example

#[derive(Ord, PartialOrd, Eq, PartialEq, ExternalPtr)]
struct Priority(u32);

#[miniextendr]
impl ROrd for Priority {}

Required Methods§

Source

fn cmp(&self, other: &Self) -> i32

Compare with another value.

Returns:

  • -1 if self < other
  • 0 if self == other
  • 1 if self > other

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.

Implementors§

Source§

impl<T: Ord> ROrd for T