pub enum Expr {
Num(Spanned<u16>),
Ident(Spanned<&'static str>),
BitOr(Box<Spanned<Expr>>, Box<Spanned<Expr>>),
DirectiveBit(Box<Spanned<Expr>>),
DirectiveSizeOfVal(Spanned<&'static str>),
}
Expand description
An “expression” means an integer constant expression.
They can assigned to a const
, or used inline in an instruction.
Variants
Num(Spanned<u16>)
An actual numeric value, without anything more to look up or evaluate.
Ident(Spanned<&'static str>)
The name of a const
BitOr(Box<Spanned<Expr>>, Box<Spanned<Expr>>)
Bitwise OR operation, left and right hand sides.
DirectiveBit(Box<Spanned<Expr>>)
bit![x]
, an arguably more readable way to write 1 << x
DirectiveSizeOfVal(Spanned<&'static str>)
size_of_val![ident]
gives the size (in bytes) of a named fn
or
static
Implementations
Trait Implementations
sourceimpl Ord for Expr
impl Ord for Expr
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<Expr> for Expr
impl PartialEq<Expr> for Expr
sourceimpl PartialOrd<Expr> for Expr
impl PartialOrd<Expr> for Expr
sourcefn partial_cmp(&self, other: &Expr) -> Option<Ordering>
fn partial_cmp(&self, other: &Expr) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Expr
impl StructuralEq for Expr
impl StructuralPartialEq for Expr
Auto Trait Implementations
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnwindSafe for Expr
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more