[−][src]Struct weld::ast::Expr
A typed Weld expression tree.
Fields
ty: Type
kind: ExprKind
annotations: Annotations
Methods
impl Expr
[src]
pub fn children(&self) -> IntoIter<&Expr>
[src]
Get an iterator for the children of this expression.
pub fn children_mut(&mut self) -> IntoIter<&mut Expr>
[src]
Get an iterator of mutable references to the children of this expression.
pub fn partially_typed(&self) -> bool
[src]
Returns whether this Expr
is partially typed.
A type is partial if it or any of its subtypes is Unknown
.
pub fn substitute(&mut self, symbol: &Symbol, replacement: &Expr)
[src]
Substitute Ident nodes with the given symbol for another expression, stopping when an expression in the tree redefines the symbol (e.g. Let or Lambda parameters).
pub fn traverse<F>(&self, func: &mut F) where
F: FnMut(&Expr),
[src]
F: FnMut(&Expr),
Run a closure on this expression and every child, in pre-order.
pub fn contains_symbol(&self, sym: &Symbol) -> bool
[src]
Returns true
if this expression contains the symbol sym
in an Ident
.
pub fn transform_and_continue<F>(&mut self, func: &mut F) where
F: FnMut(&mut Expr) -> (Option<Expr>, bool),
[src]
F: FnMut(&mut Expr) -> (Option<Expr>, bool),
Recursively transforms an expression in place by running a function on it and optionally replacing it with another expression.
pub fn transform_and_continue_res<F>(&mut self, func: &mut F) where
F: FnMut(&mut Expr) -> Result<(Option<Expr>, bool), WeldCompileError>,
[src]
F: FnMut(&mut Expr) -> Result<(Option<Expr>, bool), WeldCompileError>,
Recursively transforms an expression in place by running a function on it and optionally replacing it with another expression. Supports returning an error, which is treated as returning (None, false)
pub fn transform<F>(&mut self, func: &mut F) where
F: FnMut(&mut Expr) -> Option<Expr>,
[src]
F: FnMut(&mut Expr) -> Option<Expr>,
Recursively transforms an expression in place by running a function on it and optionally replacing it with another expression.
pub fn transform_up<F>(&mut self, func: &mut F) where
F: FnMut(&mut Expr) -> Option<Expr>,
[src]
F: FnMut(&mut Expr) -> Option<Expr>,
Recursively transforms an expression in place by running a function first on its children, then on the root
expression itself; this can be more efficient than transform
for some cases
pub fn transform_kind<F>(&mut self, func: &mut F) where
F: FnMut(&mut Expr) -> Option<ExprKind>,
[src]
F: FnMut(&mut Expr) -> Option<ExprKind>,
Transform an expression by replacing its kind with another ExprKind
.
The type of the expression is unmodified.
pub fn contains(&self, other: &Expr) -> bool
[src]
Returns true if this expressions contains other
.
Trait Implementations
impl Clone for Expr
[src]
impl CompareIgnoringSymbols for Expr
[src]
fn compare_ignoring_symbols(
&self,
other: &Expr
) -> Result<bool, WeldCompileError>
[src]
&self,
other: &Expr
) -> Result<bool, WeldCompileError>
Compare this expression to other
.
impl Debug for Expr
[src]
impl Eq for Expr
[src]
impl Hash for Expr
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl HashIgnoringSymbols for Expr
[src]
fn hash_ignoring_symbols(&self) -> Result<u64, WeldCompileError>
[src]
impl InferTypes for Expr
[src]
fn infer_types(&mut self) -> Result<(), WeldCompileError>
[src]
Checks and infers types in place.
fn infer_local(&mut self) -> Result<(), WeldCompileError>
[src]
impl NewExpr for Expr
[src]
fn new(kind: ExprKind) -> Result<Expr, WeldCompileError>
[src]
fn new_with_type(kind: ExprKind, ty: Type) -> Result<Expr, WeldCompileError>
[src]
fn new_literal(kind: LiteralKind) -> Result<Expr, WeldCompileError>
[src]
fn new_ident(symbol: Symbol, ty: Type) -> Result<Expr, WeldCompileError>
[src]
fn new_bin_op(
kind: BinOpKind,
left: Expr,
right: Expr
) -> Result<Expr, WeldCompileError>
[src]
kind: BinOpKind,
left: Expr,
right: Expr
) -> Result<Expr, WeldCompileError>
fn new_unary_op(
kind: UnaryOpKind,
value: Expr
) -> Result<Expr, WeldCompileError>
[src]
kind: UnaryOpKind,
value: Expr
) -> Result<Expr, WeldCompileError>
fn new_cast(kind: ScalarKind, expr: Expr) -> Result<Expr, WeldCompileError>
[src]
fn new_negate(expr: Expr) -> Result<Expr, WeldCompileError>
[src]
fn new_not(expr: Expr) -> Result<Expr, WeldCompileError>
[src]
fn new_broadcast(expr: Expr) -> Result<Expr, WeldCompileError>
[src]
fn new_to_vec(expr: Expr) -> Result<Expr, WeldCompileError>
[src]
fn new_make_struct(exprs: Vec<Expr>) -> Result<Expr, WeldCompileError>
[src]
fn new_make_vector(exprs: Vec<Expr>) -> Result<Expr, WeldCompileError>
[src]
fn new_make_vector_typed(
exprs: Vec<Expr>,
ty: Type
) -> Result<Expr, WeldCompileError>
[src]
exprs: Vec<Expr>,
ty: Type
) -> Result<Expr, WeldCompileError>
fn new_get_field(expr: Expr, index: u32) -> Result<Expr, WeldCompileError>
[src]
fn new_length(expr: Expr) -> Result<Expr, WeldCompileError>
[src]
fn new_lookup(data: Expr, index: Expr) -> Result<Expr, WeldCompileError>
[src]
fn new_opt_lookup(data: Expr, index: Expr) -> Result<Expr, WeldCompileError>
[src]
fn new_key_exists(data: Expr, key: Expr) -> Result<Expr, WeldCompileError>
[src]
fn new_slice(
data: Expr,
index: Expr,
size: Expr
) -> Result<Expr, WeldCompileError>
[src]
data: Expr,
index: Expr,
size: Expr
) -> Result<Expr, WeldCompileError>
fn new_sort(data: Expr, cmpfunc: Expr) -> Result<Expr, WeldCompileError>
[src]
fn new_let(
name: Symbol,
value: Expr,
body: Expr
) -> Result<Expr, WeldCompileError>
[src]
name: Symbol,
value: Expr,
body: Expr
) -> Result<Expr, WeldCompileError>
fn new_if(
cond: Expr,
on_true: Expr,
on_false: Expr
) -> Result<Expr, WeldCompileError>
[src]
cond: Expr,
on_true: Expr,
on_false: Expr
) -> Result<Expr, WeldCompileError>
fn new_select(
cond: Expr,
on_true: Expr,
on_false: Expr
) -> Result<Expr, WeldCompileError>
[src]
cond: Expr,
on_true: Expr,
on_false: Expr
) -> Result<Expr, WeldCompileError>
fn new_lambda(
params: Vec<Parameter>,
body: Expr
) -> Result<Expr, WeldCompileError>
[src]
params: Vec<Parameter>,
body: Expr
) -> Result<Expr, WeldCompileError>
fn new_apply(func: Expr, params: Vec<Expr>) -> Result<Expr, WeldCompileError>
[src]
fn new_cudf(
sym_name: String,
args: Vec<Expr>,
return_ty: Type
) -> Result<Expr, WeldCompileError>
[src]
sym_name: String,
args: Vec<Expr>,
return_ty: Type
) -> Result<Expr, WeldCompileError>
fn new_new_builder(
kind: BuilderKind,
expr: Option<Expr>
) -> Result<Expr, WeldCompileError>
[src]
kind: BuilderKind,
expr: Option<Expr>
) -> Result<Expr, WeldCompileError>
fn new_for(
iters: Vec<Iter>,
builder: Expr,
func: Expr
) -> Result<Expr, WeldCompileError>
[src]
iters: Vec<Iter>,
builder: Expr,
func: Expr
) -> Result<Expr, WeldCompileError>
fn new_merge(builder: Expr, value: Expr) -> Result<Expr, WeldCompileError>
[src]
fn new_result(builder: Expr) -> Result<Expr, WeldCompileError>
[src]
fn new_serialize(value: Expr) -> Result<Expr, WeldCompileError>
[src]
fn new_deserialize(value: Expr, ty: Type) -> Result<Expr, WeldCompileError>
[src]
impl PartialEq<Expr> for Expr
[src]
impl Placeholder for Expr
[src]
fn is_placeholder(&self) -> bool
[src]
fn new_placeholder() -> Expr
[src]
impl PrettyPrint for Expr
[src]
fn pretty_print(&self) -> String
[src]
Pretty print an expression.
fn pretty_print_config(&self, config: &PrettyPrintConfig) -> String
[src]
Pretty print an expression with the given configuration.
impl StructuralEq for Expr
[src]
impl StructuralPartialEq for Expr
[src]
impl Takeable for Expr
[src]
impl Uniquify for Expr
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Expr
impl !Send for Expr
impl !Sync for Expr
impl Unpin for Expr
impl UnwindSafe for Expr
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,