Invariant

Trait Invariant 

Source
pub trait Invariant: SemiArithmetic {
    type ValueType: SemiArithmetic;

    // Required methods
    fn from(value: &Self::ValueType) -> Self;
    fn value(&self) -> &Self::ValueType;
}

Required Associated Types§

Required Methods§

Source

fn from(value: &Self::ValueType) -> Self

Source

fn value(&self) -> &Self::ValueType

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 Invariant for bool

Source§

type ValueType = bool

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Source§

impl Invariant for f32

Source§

type ValueType = f32

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Source§

impl Invariant for f64

Source§

type ValueType = f64

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Source§

impl Invariant for i8

Source§

type ValueType = i8

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Source§

impl Invariant for i16

Source§

type ValueType = i16

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Source§

impl Invariant for i32

Source§

type ValueType = i32

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Source§

impl Invariant for i64

Source§

type ValueType = i64

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Source§

impl Invariant for i128

Source§

type ValueType = i128

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Source§

impl Invariant for isize

Source§

type ValueType = isize

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Source§

impl Invariant for u8

Source§

type ValueType = u8

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Source§

impl Invariant for u16

Source§

type ValueType = u16

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Source§

impl Invariant for u32

Source§

type ValueType = u32

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Source§

impl Invariant for u64

Source§

type ValueType = u64

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Source§

impl Invariant for u128

Source§

type ValueType = u128

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Source§

impl Invariant for usize

Source§

type ValueType = usize

Source§

fn from(value: &Self::ValueType) -> Self

Source§

fn value(&self) -> &Self::ValueType

Implementors§