NativePType

Trait NativePType 

Source
pub trait NativePType:
    Send
    + Sync
    + Clone
    + Copy
    + Debug
    + Display
    + Default
    + RefUnwindSafe
    + Num
    + NumCast
    + FromPrimitiveOrF16
    + ToBytes
    + TryFromBytes
    + Sealed
    + 'static {
    const PTYPE: PType;

    // Required methods
    fn is_nan(self) -> bool;
    fn is_infinite(self) -> bool;
    fn total_compare(self, other: Self) -> Ordering;
    fn is_eq(self, other: Self) -> bool;
    fn downcast<V: PTypeDowncast>(visitor: V) -> V::Output<Self>;
    fn upcast<V: PTypeUpcast>(input: V::Input<Self>) -> V;

    // Provided methods
    fn is_le(self, other: Self) -> bool { ... }
    fn is_lt(self, other: Self) -> bool { ... }
    fn is_ge(self, other: Self) -> bool { ... }
    fn is_gt(self, other: Self) -> bool { ... }
}
Expand description

A trait for native Rust types that correspond 1:1 to a PType.

You can use the match_each_native_ptype macro to help with writing “generic” code over dynamically typed code.

Required Associated Constants§

Source

const PTYPE: PType

The PType that corresponds to this native type

Required Methods§

Source

fn is_nan(self) -> bool

Whether this instance (self) is NaN For integer types, this is always false

Source

fn is_infinite(self) -> bool

Whether this instance (self) is Infinite For integer types, this is always false

Source

fn total_compare(self, other: Self) -> Ordering

Compare another instance of this type to self, providing a total ordering

Source

fn is_eq(self, other: Self) -> bool

Whether another instance of this type (other) is bitwise equal to self

Source

fn downcast<V: PTypeDowncast>(visitor: V) -> V::Output<Self>

Downcast the provided object to a type-specific instance.

Source

fn upcast<V: PTypeUpcast>(input: V::Input<Self>) -> V

Upcast a type-specific instance to a generic instance.

Provided Methods§

Source

fn is_le(self, other: Self) -> bool

Test whether self is less than or equal to the other

Source

fn is_lt(self, other: Self) -> bool

Test whether self is less than the other

Source

fn is_ge(self, other: Self) -> bool

Test whether self is greater than or equal to the other

Source

fn is_gt(self, other: Self) -> bool

Test whether self is greater than the 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.

Implementations on Foreign Types§

Source§

impl NativePType for f32

Source§

const PTYPE: PType = PType::F32

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn total_compare(self, other: Self) -> Ordering

Source§

fn is_eq(self, other: Self) -> bool

Source§

fn downcast<V: PTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: PTypeUpcast>(input: V::Input<Self>) -> V

Source§

impl NativePType for f64

Source§

const PTYPE: PType = PType::F64

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn total_compare(self, other: Self) -> Ordering

Source§

fn is_eq(self, other: Self) -> bool

Source§

fn downcast<V: PTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: PTypeUpcast>(input: V::Input<Self>) -> V

Source§

impl NativePType for i8

Source§

const PTYPE: PType = PType::I8

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn total_compare(self, other: Self) -> Ordering

Source§

fn is_eq(self, other: Self) -> bool

Source§

fn downcast<V: PTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: PTypeUpcast>(input: V::Input<Self>) -> V

Source§

impl NativePType for i16

Source§

const PTYPE: PType = PType::I16

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn total_compare(self, other: Self) -> Ordering

Source§

fn is_eq(self, other: Self) -> bool

Source§

fn downcast<V: PTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: PTypeUpcast>(input: V::Input<Self>) -> V

Source§

impl NativePType for i32

Source§

const PTYPE: PType = PType::I32

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn total_compare(self, other: Self) -> Ordering

Source§

fn is_eq(self, other: Self) -> bool

Source§

fn downcast<V: PTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: PTypeUpcast>(input: V::Input<Self>) -> V

Source§

impl NativePType for i64

Source§

const PTYPE: PType = PType::I64

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn total_compare(self, other: Self) -> Ordering

Source§

fn is_eq(self, other: Self) -> bool

Source§

fn downcast<V: PTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: PTypeUpcast>(input: V::Input<Self>) -> V

Source§

impl NativePType for u8

Source§

const PTYPE: PType = PType::U8

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn total_compare(self, other: Self) -> Ordering

Source§

fn is_eq(self, other: Self) -> bool

Source§

fn downcast<V: PTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: PTypeUpcast>(input: V::Input<Self>) -> V

Source§

impl NativePType for u16

Source§

const PTYPE: PType = PType::U16

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn total_compare(self, other: Self) -> Ordering

Source§

fn is_eq(self, other: Self) -> bool

Source§

fn downcast<V: PTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: PTypeUpcast>(input: V::Input<Self>) -> V

Source§

impl NativePType for u32

Source§

const PTYPE: PType = PType::U32

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn total_compare(self, other: Self) -> Ordering

Source§

fn is_eq(self, other: Self) -> bool

Source§

fn downcast<V: PTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: PTypeUpcast>(input: V::Input<Self>) -> V

Source§

impl NativePType for u64

Source§

const PTYPE: PType = PType::U64

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn total_compare(self, other: Self) -> Ordering

Source§

fn is_eq(self, other: Self) -> bool

Source§

fn downcast<V: PTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: PTypeUpcast>(input: V::Input<Self>) -> V

Source§

impl NativePType for f16

Source§

const PTYPE: PType = PType::F16

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn total_compare(self, other: Self) -> Ordering

Source§

fn is_eq(self, other: Self) -> bool

Source§

fn downcast<V: PTypeDowncast>(visitor: V) -> V::Output<Self>

Source§

fn upcast<V: PTypeUpcast>(input: V::Input<Self>) -> V

Implementors§