Skip to main content

Expr

Enum Expr 

Source
pub enum Expr {
    Lit(f64),
    Var(Var),
    BinOp {
        op: Op,
        left: Box<Expr>,
        right: Box<Expr>,
    },
    UnaryOp {
        op: UnaryOp,
        arg: Box<Expr>,
    },
    If {
        cond: Box<Expr>,
        then: Box<Expr>,
        else_: Box<Expr>,
    },
    Fn {
        name: String,
        args: Vec<Expr>,
    },
}

Variants§

§

Lit(f64)

§

Var(Var)

§

BinOp

Fields

§op: Op
§left: Box<Expr>
§right: Box<Expr>
§

UnaryOp

Fields

§arg: Box<Expr>
§

If

Fields

§cond: Box<Expr>
§then: Box<Expr>
§else_: Box<Expr>
§

Fn

Fields

§name: String
§args: Vec<Expr>

Implementations§

Source§

impl Expr

Source

pub fn lit(n: f64) -> Expr

Source

pub fn var(v: Var) -> Expr

Source

pub fn gt(self, other: impl Into<Expr>) -> Expr

Source

pub fn gte(self, other: impl Into<Expr>) -> Expr

Source

pub fn lt(self, other: impl Into<Expr>) -> Expr

Source

pub fn lte(self, other: impl Into<Expr>) -> Expr

Source

pub fn eq(self, other: impl Into<Expr>) -> Expr

Source

pub fn if_then_else(self, then: impl Into<Expr>, else_: impl Into<Expr>) -> Expr

Source

pub fn sin(self) -> Expr

Source

pub fn cos(self) -> Expr

Source

pub fn tan(self) -> Expr

Source

pub fn abs(self) -> Expr

Source

pub fn sqrt(self) -> Expr

Source

pub fn ceil(self) -> Expr

Source

pub fn floor(self) -> Expr

Source

pub fn round(self) -> Expr

Source

pub fn log(self) -> Expr

Source

pub fn exp(self) -> Expr

Source

pub fn not(self) -> Expr

Source

pub fn call(name: impl Into<String>, args: Vec<Expr>) -> Expr

Source

pub fn compile(&self) -> String

Trait Implementations§

Source§

impl Add<Expr> for f64

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Add<f64> for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: f64) -> Expr

Performs the + operation. Read more
Source§

impl Add for Expr

Source§

type Output = Expr

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Expr) -> Expr

Performs the + operation. Read more
Source§

impl Clone for Expr

Source§

fn clone(&self) -> Expr

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Expr

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Div<Expr> for f64

Source§

type Output = Expr

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Expr) -> Expr

Performs the / operation. Read more
Source§

impl Div<f64> for Expr

Source§

type Output = Expr

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> Expr

Performs the / operation. Read more
Source§

impl Div for Expr

Source§

type Output = Expr

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Expr) -> Expr

Performs the / operation. Read more
Source§

impl From<Expr> for NumberOrExpr

Source§

fn from(e: Expr) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Expr

Source§

fn from(n: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Expr

Source§

fn from(n: i32) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Expr

Source§

fn from(n: u32) -> Self

Converts to this type from the input type.
Source§

impl Mul<Expr> for f64

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Expr) -> Expr

Performs the * operation. Read more
Source§

impl Mul<f64> for Expr

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> Expr

Performs the * operation. Read more
Source§

impl Mul for Expr

Source§

type Output = Expr

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Expr) -> Expr

Performs the * operation. Read more
Source§

impl Sub<Expr> for f64

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more
Source§

impl Sub<f64> for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: f64) -> Expr

Performs the - operation. Read more
Source§

impl Sub for Expr

Source§

type Output = Expr

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Expr) -> Expr

Performs the - operation. Read more

Auto Trait Implementations§

§

impl Freeze for Expr

§

impl RefUnwindSafe for Expr

§

impl Send for Expr

§

impl Sync for Expr

§

impl Unpin for Expr

§

impl UnsafeUnpin for Expr

§

impl UnwindSafe for Expr

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more