ValueType

Trait ValueType 

Source
pub trait ValueType:
    Sized
    + Clone
    + PartialEq
    + Debug {
    type NegateOutput: ValueType;

    const TYPE: Type;
Show 16 methods // Provided methods fn equals(_a: Self, _b: Self) -> Result<bool, OperatorError> { ... } fn less_than(_a: Self, _b: Self) -> Result<bool, OperatorError> { ... } fn less_than_or_equal(a: Self, b: Self) -> Result<bool, OperatorError> { ... } fn not_equals(a: Self, b: Self) -> Result<bool, OperatorError> { ... } fn bitwise_or(_a: Self, _b: Self) -> Result<Self, OperatorError> { ... } fn bitwise_xor(_a: Self, _b: Self) -> Result<Self, OperatorError> { ... } fn bitwise_and(_a: Self, _b: Self) -> Result<Self, OperatorError> { ... } fn shift_left(_a: Self, _b: Self) -> Result<Self, OperatorError> { ... } fn shift_right(_a: Self, _b: Self) -> Result<Self, OperatorError> { ... } fn add(_a: Self, _b: Self) -> Result<Self, OperatorError> { ... } fn subtract(_a: Self, _b: Self) -> Result<Self, OperatorError> { ... } fn multiply(_a: Self, _b: Self) -> Result<Self, OperatorError> { ... } fn divide(_a: Self, _b: Self) -> Result<Self, OperatorError> { ... } fn modulo(_a: Self, _b: Self) -> Result<Self, OperatorError> { ... } fn not(_a: Self) -> Result<Self, OperatorError> { ... } fn negate(_a: Self) -> Result<Self::NegateOutput, OperatorError> { ... }
}
Expand description

A Rust type that is used as the storage for a Somni type.

Required Associated Constants§

Source

const TYPE: Type

The Somni type this Rust type is used for.

Required Associated Types§

Source

type NegateOutput: ValueType

The type of the result of the unary - operator.

Provided Methods§

Source

fn equals(_a: Self, _b: Self) -> Result<bool, OperatorError>

Implements the == operator.

Source

fn less_than(_a: Self, _b: Self) -> Result<bool, OperatorError>

Implements the < operator.

Source

fn less_than_or_equal(a: Self, b: Self) -> Result<bool, OperatorError>

Implements the <= operator.

Source

fn not_equals(a: Self, b: Self) -> Result<bool, OperatorError>

Implements the != operator.

Source

fn bitwise_or(_a: Self, _b: Self) -> Result<Self, OperatorError>

Implements the | operator.

Source

fn bitwise_xor(_a: Self, _b: Self) -> Result<Self, OperatorError>

Implements the ^ operator.

Source

fn bitwise_and(_a: Self, _b: Self) -> Result<Self, OperatorError>

Implements the & operator.

Source

fn shift_left(_a: Self, _b: Self) -> Result<Self, OperatorError>

Implements the << operator.

Source

fn shift_right(_a: Self, _b: Self) -> Result<Self, OperatorError>

Implements the >> operator.

Source

fn add(_a: Self, _b: Self) -> Result<Self, OperatorError>

Implements the + operator.

Source

fn subtract(_a: Self, _b: Self) -> Result<Self, OperatorError>

Implements the binary - operator.

Source

fn multiply(_a: Self, _b: Self) -> Result<Self, OperatorError>

Implements the binary * operator.

Source

fn divide(_a: Self, _b: Self) -> Result<Self, OperatorError>

Implements the binary / operator.

Source

fn modulo(_a: Self, _b: Self) -> Result<Self, OperatorError>

Implements the binary % operator.

Source

fn not(_a: Self) -> Result<Self, OperatorError>

Implements the unary ! operator.

Source

fn negate(_a: Self) -> Result<Self::NegateOutput, OperatorError>

Implements the unary - operator.

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 ValueType for &str

Source§

const TYPE: Type = Type::String

Source§

type NegateOutput = &str

Source§

fn equals(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

impl ValueType for bool

Source§

const TYPE: Type = Type::Bool

Source§

type NegateOutput = bool

Source§

fn equals(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn bitwise_and(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn bitwise_or(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn bitwise_xor(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn not(a: Self) -> Result<bool, OperatorError>

Source§

impl ValueType for f32

Source§

const TYPE: Type = Type::Float

Source§

type NegateOutput = f32

Source§

fn less_than(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn equals(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn add(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn subtract(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn multiply(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn divide(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn modulo(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn negate(a: Self) -> Result<Self::NegateOutput, OperatorError>

Source§

impl ValueType for f64

Source§

const TYPE: Type = Type::Float

Source§

type NegateOutput = f64

Source§

fn less_than(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn equals(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn add(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn subtract(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn multiply(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn divide(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn modulo(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn negate(a: Self) -> Result<Self::NegateOutput, OperatorError>

Source§

impl ValueType for i32

Source§

const TYPE: Type = Type::SignedInt

Source§

type NegateOutput = i32

Source§

fn less_than(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn equals(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn add(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn subtract(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn multiply(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn divide(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn modulo(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_or(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_xor(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_and(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn shift_left(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn shift_right(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn not(a: Self) -> Result<Self, OperatorError>

Source§

fn negate(a: Self) -> Result<Self::NegateOutput, OperatorError>

Source§

impl ValueType for i64

Source§

const TYPE: Type = Type::SignedInt

Source§

type NegateOutput = i64

Source§

fn less_than(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn equals(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn add(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn subtract(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn multiply(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn divide(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn modulo(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_or(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_xor(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_and(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn shift_left(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn shift_right(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn not(a: Self) -> Result<Self, OperatorError>

Source§

fn negate(a: Self) -> Result<Self::NegateOutput, OperatorError>

Source§

impl ValueType for i128

Source§

const TYPE: Type = Type::SignedInt

Source§

type NegateOutput = i128

Source§

fn less_than(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn equals(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn add(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn subtract(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn multiply(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn divide(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn modulo(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_or(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_xor(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_and(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn shift_left(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn shift_right(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn not(a: Self) -> Result<Self, OperatorError>

Source§

fn negate(a: Self) -> Result<Self::NegateOutput, OperatorError>

Source§

impl ValueType for u32

Source§

const TYPE: Type = Type::Int

Source§

type NegateOutput = i32

Source§

fn less_than(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn equals(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn add(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn subtract(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn multiply(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn divide(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn modulo(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_or(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_xor(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_and(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn shift_left(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn shift_right(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn not(a: Self) -> Result<Self, OperatorError>

Source§

fn negate(a: Self) -> Result<Self::NegateOutput, OperatorError>

Source§

impl ValueType for u64

Source§

const TYPE: Type = Type::Int

Source§

type NegateOutput = i64

Source§

fn less_than(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn equals(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn add(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn subtract(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn multiply(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn divide(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn modulo(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_or(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_xor(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_and(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn shift_left(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn shift_right(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn not(a: Self) -> Result<Self, OperatorError>

Source§

fn negate(a: Self) -> Result<Self::NegateOutput, OperatorError>

Source§

impl ValueType for u128

Source§

const TYPE: Type = Type::Int

Source§

type NegateOutput = i128

Source§

fn less_than(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn equals(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

fn add(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn subtract(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn multiply(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn divide(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn modulo(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_or(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_xor(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn bitwise_and(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn shift_left(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn shift_right(a: Self, b: Self) -> Result<Self, OperatorError>

Source§

fn not(a: Self) -> Result<Self, OperatorError>

Source§

fn negate(a: Self) -> Result<Self::NegateOutput, OperatorError>

Source§

impl ValueType for ()

Source§

const TYPE: Type = Type::Void

Source§

type NegateOutput = ()

Source§

impl ValueType for Box<str>

Source§

const TYPE: Type = Type::String

Source§

type NegateOutput = Box<str>

Source§

fn equals(a: Self, b: Self) -> Result<bool, OperatorError>

Source§

impl ValueType for String

Source§

const TYPE: Type = Type::String

Source§

type NegateOutput = String

Source§

fn equals(a: Self, b: Self) -> Result<bool, OperatorError>

Implementors§