[][src]Enum abi_stable::std_types::RCmpOrdering

#[repr(u8)]pub enum RCmpOrdering {
    Less,
    Equal,
    Greater,
}

Ffi-safe equivalent of std::cmp::Ordering.

Example

This defines an extern function,which compares a slice to another.


use abi_stable::{
    std_types::{RCmpOrdering,RSlice},
    sabi_extern_fn,
};
use std::cmp::Ord;


#[sabi_extern_fn]
pub fn compare_slices<T>(l:RSlice<'_,T>, r:RSlice<'_,T>)->RCmpOrdering
where
    T:Ord
{
    l.cmp(&r)
     .into()
}

Variants

Less
Equal
Greater

Implementations

impl RCmpOrdering[src]

pub fn into_ordering(self) -> Ordering[src]

Converts this RCmpOrdering into a std::cmp::Ordering;

Example

use abi_stable::std_types::RCmpOrdering;
use std::cmp::Ordering;
 

assert_eq!( RCmpOrdering::Less.into_ordering(), Ordering::Less );
assert_eq!( RCmpOrdering::Equal.into_ordering(), Ordering::Equal );
assert_eq!( RCmpOrdering::Greater.into_ordering(), Ordering::Greater );

Trait Implementations

impl Clone for RCmpOrdering[src]

impl Copy for RCmpOrdering[src]

impl Debug for RCmpOrdering[src]

impl<'de> Deserialize<'de> for RCmpOrdering[src]

impl Eq for RCmpOrdering[src]

impl From<Ordering> for RCmpOrdering[src]

impl GetStaticEquivalent_ for RCmpOrdering[src]

type StaticEquivalent = _static_RCmpOrdering

impl Hash for RCmpOrdering[src]

impl Into<Ordering> for RCmpOrdering[src]

impl IntoReprRust for RCmpOrdering[src]

type ReprRust = Ordering

The #[repr(Rust)] equivalent.

impl Ord for RCmpOrdering[src]

impl PartialEq<RCmpOrdering> for RCmpOrdering[src]

impl PartialOrd<RCmpOrdering> for RCmpOrdering[src]

impl Serialize for RCmpOrdering[src]

impl StableAbi for RCmpOrdering[src]

type IsNonZeroType = False

Whether this type has a single invalid bit-pattern. Read more

impl StructuralEq for RCmpOrdering[src]

impl StructuralPartialEq for RCmpOrdering[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, T> BorrowOwned<'a> for T where
    T: 'a + Clone
[src]

type ROwned = T

The owned type, stored in RCow::Owned

type RBorrowed = &'a T

The borrowed type, stored in RCow::Borrowed

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T> GetWithMetadata for T[src]

type ForSelf = WithMetadata_<T, T>

This is always WithMetadata_<Self, Self>

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SelfOps for T where
    T: ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<This> TransmuteElement for This where
    This: ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The error type returned when the conversion fails.

impl<T> TypeIdentity for T where
    T: ?Sized
[src]

type Type = T

The same type as Self. Read more

impl<This> ValidTag_Bounds for This where
    This: Debug + Clone + PartialEq<This>, 
[src]