[−][src]Enum arithmetic_parser::Expr
Arithmetic expression with an abstract types for type hints and literals.
Variants
Variable use, e.g., x
.
Literal(T::Lit)
Literal (semantic depends on T
).
FnDefinition(FnDefinition<'a, T>)
Function definition, e.g., |x, y| { x + y }
.
Function call, e.g., foo(x, y)
or |x| { x + 5 }(3)
.
Fields of Function
name: Box<SpannedExpr<'a, T>>
Function value. In the simplest case, this is a variable, but may also be another
kind of expression, such as |x| { x + 5 }
in |x| { x + 5 }(3)
.
args: Vec<SpannedExpr<'a, T>>
Function arguments.
Method call, e.g., foo.bar(x, 5)
.
Fields of Method
name: Span<'a>
Name of the called method, e.g. bar
in foo.bar(x, 5)
.
receiver: Box<SpannedExpr<'a, T>>
Receiver of the call, e.g., foo
in foo.bar(x, 5)
.
args: Vec<SpannedExpr<'a, T>>
Arguments; e.g., x, 5
in foo.bar(x, 5)
.
Unary operation, e.g., -x
.
Fields of Unary
Binary operation, e.g., x + 1
.
Fields of Binary
lhs: Box<SpannedExpr<'a, T>>
LHS of the operation.
op: Spanned<'a, BinaryOp>
Operator.
rhs: Box<SpannedExpr<'a, T>>
RHS of the operation.
Tuple(Vec<SpannedExpr<'a, T>>)
Tuple expression, e.g., (x, y + z)
.
Block(Block<'a, T>)
Block expression, e.g., { x = 3; x + y }
.
Implementations
impl<T: Grammar, '_> Expr<'_, T>
[src]
pub fn binary_lhs(&self) -> Option<&SpannedExpr<'_, T>>
[src]
Returns LHS of the binary expression. If this is not a binary expression, returns None
.
pub fn binary_rhs(&self) -> Option<&SpannedExpr<'_, T>>
[src]
Returns RHS of the binary expression. If this is not a binary expression, returns None
.
Trait Implementations
impl<T: Grammar, '_> Clone for Expr<'_, T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, T: Debug> Debug for Expr<'a, T> where
T: Grammar,
T::Lit: Debug,
[src]
T: Grammar,
T::Lit: Debug,
impl<T, '_> PartialEq<Expr<'_, T>> for Expr<'_, T> where
T: Grammar,
T::Lit: PartialEq,
T::Type: PartialEq,
[src]
T: Grammar,
T::Lit: PartialEq,
T::Type: PartialEq,
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Expr<'a, T> where
<T as Grammar>::Lit: RefUnwindSafe,
<T as Grammar>::Type: RefUnwindSafe,
<T as Grammar>::Lit: RefUnwindSafe,
<T as Grammar>::Type: RefUnwindSafe,
impl<'a, T> Send for Expr<'a, T> where
<T as Grammar>::Lit: Send,
<T as Grammar>::Type: Send,
<T as Grammar>::Lit: Send,
<T as Grammar>::Type: Send,
impl<'a, T> Sync for Expr<'a, T> where
<T as Grammar>::Lit: Sync,
<T as Grammar>::Type: Sync,
<T as Grammar>::Lit: Sync,
<T as Grammar>::Type: Sync,
impl<'a, T> Unpin for Expr<'a, T> where
<T as Grammar>::Lit: Unpin,
<T as Grammar>::Type: Unpin,
<T as Grammar>::Lit: Unpin,
<T as Grammar>::Type: Unpin,
impl<'a, T> UnwindSafe for Expr<'a, T> where
<T as Grammar>::Lit: UnwindSafe,
<T as Grammar>::Type: UnwindSafe,
<T as Grammar>::Lit: UnwindSafe,
<T as Grammar>::Type: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,