Enum rgbds_obj::RpnOp[][src]

pub enum RpnOp<'a> {
Show variants Add, Sub, Mul, Div, Mod, Neg, Pow, BinOr, BinAnd, Xor, Cpl, And, Or, Not, Eq, Neq, Gt, Lt, Gte, Lte, Lsh, Rsh, BankSym(u32), BankSect(&'a [u8]), BankSelf, SizeofSect(&'a [u8]), StartofSect(&'a [u8]), HramCheck, RstCheck, Int(u32), Sym(u32),
}

A RPN operation; since this means “operation on the RPN stack” here, this includes literals, not just operators.

Variants

Add

+ operator.

Sub

- operator.

Mul

* operator.

Div

/ operator.

Mod

% operator.

Neg

Unary - operator.

Pow

** operator.

BinOr

| operator.

BinAnd

& operator.

Xor

^ operator.

Cpl

~ operator.

And

&& operator.

Or

|| operator.

Not

! operator.

Eq

== operator.

Neq

!= operator.

Gt

> operator.

Lt

< operator.

Gte

>= operator.

Lte

<= operator.

Lsh

<< operator.

Rsh

>> operator.

BankSym(u32)

BANK(Symbol)

BankSect(&'a [u8])

BANK("section")

BankSelf

BANK(@)

SizeofSect(&'a [u8])

SIZEOF("section")

StartofSect(&'a [u8])

STARTOF("section")

HramCheck

HRAM check (check if the value is in HRAM range, then & 0xFF).

RstCheck

rst check (check if the value is a rst target, then | 0xC7).

Int(u32)

32-bit literal.

Sym(u32)

Symbol (referenced by 32-bit ID).

Implementations

impl RpnOp<'_>[src]

pub fn arity(&self) -> Arity[src]

The operation’s arity.

pub fn precedence(&self) -> u8[src]

The operation’s precedence.

Panics

This function panics if the operation is not a binary operator.

pub fn is_associative(&self) -> bool[src]

Whether this operation is associative; that is, if A op (B op C) == (A op B) op C.

Panics

This function panics if the operation is not a binary operator.

pub fn needs_parens(&self, parent: &RpnOp<'_>, is_left: bool) -> bool[src]

Computes whether parens are needed (for pretty-printing) around a child expression, with the given parent.

Trait Implementations

impl<'a> Debug for RpnOp<'a>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Display for RpnOp<'_>[src]

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl<'a> PartialEq<RpnOp<'a>> for RpnOp<'a>[src]

fn eq(&self, other: &RpnOp<'a>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &RpnOp<'a>) -> bool[src]

This method tests for !=.

impl<'a> StructuralPartialEq for RpnOp<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for RpnOp<'a>

impl<'a> Send for RpnOp<'a>

impl<'a> Sync for RpnOp<'a>

impl<'a> Unpin for RpnOp<'a>

impl<'a> UnwindSafe for RpnOp<'a>

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

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.

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

Performs the conversion.

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.

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

Performs the conversion.