[][src]Struct prec::Expression

pub struct Expression<Op: Copy, To: Clone> {
    pub first_token: To,
    pub pairs: Vec<(Op, To)>,
}

A faithful, always-valid representation of an expression.

It's impossible to throw an error due to the order of token, operator, token not being respected.

Fields

first_token: Topairs: Vec<(Op, To)>

Implementations

impl<Op: Copy, To: Clone> Expression<Op, To>[src]

pub fn new(first_token: To, pairs: Vec<(Op, To)>) -> Self[src]

This example is not tested
// 5 * 6 + 3 / 2 ^ 4
let expression = Expression::new(
	5.0f64,
	vec![
		(Op::Mul, 6.0),
		(Op::Add, 3.0),
		(Op::Div, 2.0),
		(Op::Exp, 4.0)
	]
);

Trait Implementations

impl<Op: Clone + Copy, To: Clone> Clone for Expression<Op, To>[src]

impl<Op: Debug + Copy, To: Debug + Clone> Debug for Expression<Op, To>[src]

impl<Op: Copy + Display, To: Clone + Display> Display for Expression<Op, To>[src]

impl<Op: Copy + Eq, To: Clone + Eq> Eq for Expression<Op, To>[src]

impl<Op: Copy + PartialEq, To: Clone + PartialEq> PartialEq<Expression<Op, To>> for Expression<Op, To>[src]

Auto Trait Implementations

impl<Op, To> RefUnwindSafe for Expression<Op, To> where
    Op: RefUnwindSafe,
    To: RefUnwindSafe
[src]

impl<Op, To> Send for Expression<Op, To> where
    Op: Send,
    To: Send
[src]

impl<Op, To> Sync for Expression<Op, To> where
    Op: Sync,
    To: Sync
[src]

impl<Op, To> Unpin for Expression<Op, To> where
    Op: Unpin,
    To: Unpin
[src]

impl<Op, To> UnwindSafe for Expression<Op, To> where
    Op: UnwindSafe,
    To: UnwindSafe
[src]

Blanket Implementations

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

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

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

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

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.

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.