pub enum AnyExpr {
Num(Ex),
Bool(BoolEx),
Set(SetEx),
}Expand description
An expression of any sort, read from its root node: what
Context::from_json_any
returns for a serialized tree whose sort is not known in advance.
use symplex::prelude::*;
let ctx = Context::new();
let x = ctx.symbol("x");
let json = x.gt(&ctx.int(1)).to_json()?;
match ctx.from_json_any(&json)? {
AnyExpr::Bool(b) => assert_eq!(format!("{b}"), "x > 1"),
other => panic!("expected a relation, got {other:?}"),
}Variants§
Num(Ex)
A numeric expression.
Bool(BoolEx)
A boolean expression: a relation, And, Or, Not, True or
False.
Set(SetEx)
A set: an interval, a finite set, a union, an intersection, a complement, an image set or a condition set.
Trait Implementations§
impl Eq for AnyExpr
impl StructuralPartialEq for AnyExpr
Auto Trait Implementations§
impl !RefUnwindSafe for AnyExpr
impl !UnwindSafe for AnyExpr
impl Freeze for AnyExpr
impl Send for AnyExpr
impl Sync for AnyExpr
impl Unpin for AnyExpr
impl UnsafeUnpin for AnyExpr
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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