Skip to main content

RtArith

Struct RtArith 

Source
pub struct RtArith;
Expand description

Arithmetic operations on runtime objects.

Implementations§

Source§

impl RtArith

Source

pub fn nat_add(a: &RtObject, b: &RtObject) -> Option<RtObject>

Add two natural numbers.

Source

pub fn nat_sub(a: &RtObject, b: &RtObject) -> Option<RtObject>

Subtract two natural numbers (saturating).

Source

pub fn nat_mul(a: &RtObject, b: &RtObject) -> Option<RtObject>

Multiply two natural numbers.

Source

pub fn nat_div(a: &RtObject, b: &RtObject) -> Option<RtObject>

Divide two natural numbers (integer division, rounds toward zero).

Source

pub fn nat_mod(a: &RtObject, b: &RtObject) -> Option<RtObject>

Modulo of two natural numbers.

Source

pub fn nat_le(a: &RtObject, b: &RtObject) -> Option<RtObject>

Compare two natural numbers (less than or equal).

Source

pub fn nat_lt(a: &RtObject, b: &RtObject) -> Option<RtObject>

Compare two natural numbers (less than).

Source

pub fn nat_eq(a: &RtObject, b: &RtObject) -> Option<RtObject>

Compare two natural numbers for equality.

Source

pub fn bool_and(a: &RtObject, b: &RtObject) -> Option<RtObject>

Boolean AND.

Source

pub fn bool_or(a: &RtObject, b: &RtObject) -> Option<RtObject>

Boolean OR.

Source

pub fn bool_not(a: &RtObject) -> Option<RtObject>

Boolean NOT.

Source

pub fn int_add(a: &RtObject, b: &RtObject) -> Option<RtObject>

Integer addition.

Source

pub fn int_sub(a: &RtObject, b: &RtObject) -> Option<RtObject>

Integer subtraction.

Source

pub fn int_mul(a: &RtObject, b: &RtObject) -> Option<RtObject>

Integer multiplication.

Source

pub fn int_neg(a: &RtObject) -> Option<RtObject>

Integer negation.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.