pub struct Expr { /* private fields */ }Expand description
A parsed, ready-to-evaluate expression.
Implementations§
Source§impl Expr
impl Expr
Sourcepub fn parse(source: &str) -> Result<Self, ExprError>
pub fn parse(source: &str) -> Result<Self, ExprError>
Parse a source string into a ready-to-evaluate expression.
Sourcepub fn eval(&self, ctx: &ExprContext) -> Kind
pub fn eval(&self, ctx: &ExprContext) -> Kind
Evaluate the expression, returning Kind::NA on any failure.
Sourcepub fn eval_number(&self, ctx: &ExprContext) -> f64
pub fn eval_number(&self, ctx: &ExprContext) -> f64
Evaluate and extract an f64, returning NaN on failure.
Sourcepub fn eval_bool(&self, ctx: &ExprContext) -> bool
pub fn eval_bool(&self, ctx: &ExprContext) -> bool
Evaluate and extract a bool, returning false on failure.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more