pub struct Builder;
Expand description
Construct an Expr
.
Trait Implementations§
Source§impl ExprBuilder for Builder
impl ExprBuilder for Builder
Source§fn unknown(self, u: Unknown) -> Expr
fn unknown(self, u: Unknown) -> Expr
An extension call with one arg, which is the name of the unknown
Source§fn is_entity_type(self, left: Expr, entity_type: EntityType) -> Expr
fn is_entity_type(self, left: Expr, entity_type: EntityType) -> Expr
left is entity_type
Source§fn is_in_entity_type(
self,
left: Expr,
entity_type: EntityType,
entity: Expr,
) -> Expr
fn is_in_entity_type( self, left: Expr, entity_type: EntityType, entity: Expr, ) -> Expr
left is entity_type in entity
Source§fn ite(self, cond_expr: Expr, then_expr: Expr, else_expr: Expr) -> Expr
fn ite(self, cond_expr: Expr, then_expr: Expr, else_expr: Expr) -> Expr
if cond_expr then then_expr else else_expr
Source§fn set(self, elements: impl IntoIterator<Item = Expr>) -> Expr
fn set(self, elements: impl IntoIterator<Item = Expr>) -> Expr
e.g. [1+2, !(context has department)]
Source§fn record(
self,
map: impl IntoIterator<Item = (SmolStr, Expr)>,
) -> Result<Expr, ExpressionConstructionError>
fn record( self, map: impl IntoIterator<Item = (SmolStr, Expr)>, ) -> Result<Expr, ExpressionConstructionError>
e.g. {foo: 1+2, bar: !(context has department)}
Source§fn call_extension_fn(
self,
fn_name: Name,
args: impl IntoIterator<Item = Expr>,
) -> Expr
fn call_extension_fn( self, fn_name: Name, args: impl IntoIterator<Item = Expr>, ) -> Expr
extension function call, including method calls
Source§type Data = ()
type Data = ()
Type for extra information stored on nodes of the expression AST. This
can be
()
if no data is stored.Source§fn with_maybe_source_loc(self, _: Option<&Loc>) -> Self
fn with_maybe_source_loc(self, _: Option<&Loc>) -> Self
Build an expression located at
l
, if l
is Some. An implementation
may ignore this if it cannot store source information.Source§fn loc(&self) -> Option<&Loc>
fn loc(&self) -> Option<&Loc>
Extract the location for this builder, if set. Used internally to
provide utilities that construct multiple nodes which should all be
reported as having the same source location.
Source§fn data(&self) -> &Self::Data
fn data(&self) -> &Self::Data
Extract the data that will be stored on the constructed expression.
Used internally to provide utilities that construct multiple nodes which
will all have the same data.
Source§fn new() -> Selfwhere
Self: Sized,
fn new() -> Selfwhere
Self: Sized,
Construct a new expression builder for an expression that will not carry any data.
Source§fn with_source_loc(self, l: &Loc) -> Selfwhere
Self: Sized,
fn with_source_loc(self, l: &Loc) -> Selfwhere
Self: Sized,
Build an expression located at
l
. An implementation may ignore this if
it cannot store source information.Source§fn unary_app(self, op: impl Into<UnaryOp>, arg: Self::Expr) -> Self::Exprwhere
Self: Sized,
fn unary_app(self, op: impl Into<UnaryOp>, arg: Self::Expr) -> Self::Exprwhere
Self: Sized,
Create an application
Expr
which applies the given built-in unary
operator to the given arg
Source§fn binary_app(
self,
op: impl Into<BinaryOp>,
arg1: Self::Expr,
arg2: Self::Expr,
) -> Self::Exprwhere
Self: Sized,
fn binary_app(
self,
op: impl Into<BinaryOp>,
arg1: Self::Expr,
arg2: Self::Expr,
) -> Self::Exprwhere
Self: Sized,
Create an application
Expr
which applies the given built-in binary
operator to arg1
and arg2
Source§fn and_nary(
self,
first: Self::Expr,
others: impl IntoIterator<Item = Self::Expr>,
) -> Self::Exprwhere
Self: Sized,
fn and_nary(
self,
first: Self::Expr,
others: impl IntoIterator<Item = Self::Expr>,
) -> Self::Exprwhere
Self: Sized,
Create an
and
expression that may have more than two subexpressions (A && B && C)
or may have only one subexpression, in which case no &&
is performed at all.
Arguments must evaluate to Bool type. Read moreSource§fn or_nary(
self,
first: Self::Expr,
others: impl IntoIterator<Item = Self::Expr>,
) -> Self::Exprwhere
Self: Sized,
fn or_nary(
self,
first: Self::Expr,
others: impl IntoIterator<Item = Self::Expr>,
) -> Self::Exprwhere
Self: Sized,
Create an
or
expression that may have more than two subexpressions (A || B || C)
or may have only one subexpression, in which case no ||
is performed at all.
Arguments must evaluate to Bool type. Read moreSource§fn add_nary(
self,
first: Self::Expr,
other: impl IntoIterator<Item = (AddOp, Self::Expr)>,
) -> Self::Exprwhere
Self: Sized,
fn add_nary(
self,
first: Self::Expr,
other: impl IntoIterator<Item = (AddOp, Self::Expr)>,
) -> Self::Exprwhere
Self: Sized,
Create expression containing addition and subtraction that may have more
than two subexpressions (A + B - C) or may have only one subexpression,
in which case no operations are performed at all.
Source§fn mul_nary(
self,
first: Self::Expr,
other: impl IntoIterator<Item = Self::Expr>,
) -> Self::Exprwhere
Self: Sized,
fn mul_nary(
self,
first: Self::Expr,
other: impl IntoIterator<Item = Self::Expr>,
) -> Self::Exprwhere
Self: Sized,
Create expression containing multiplication that may have more than two
subexpressions (A * B * C) or may have only one subexpression,
in which case no operations are performed at all.
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
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> 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