Module ra_ap_syntax::ast::make[][src]

Expand description

This module contains free-standing functions for creating AST fragments out of smaller pieces.

Note that all functions here intended to be stupid constructors, which just assemble a finish node from immediate children. If you want to do something smarter than that, it belongs to the ext submodule.

Keep in mind that from_text functions should be kept private. The public API should require to assemble every node piecewise. The trick of parse(format!()) we use internally is an implementation detail – long term, it will be replaced with direct tree manipulation.

Modules

ext

While the parent module defines basic atomic “constructors”, the ext module defines shortcuts for common things.

tokens

Functions

arg_list
assoc_item_list
block_expr
condition
expr_assignment
expr_break
expr_call
expr_continue
expr_empty_block
expr_for_loop
expr_if
expr_literal
expr_match
expr_method_call
expr_paren
expr_path
expr_prefix
expr_ref
expr_return
expr_stmt
expr_try
expr_tuple
expr_unit
fn_
generic_param_list
ident_mut_pat
ident_pat
impl_trait
let_stmt
lifetime
lifetime_param
literal_pat
match_arm
match_arm_list
name
name_ref
param
param_list
path_concat
path_from_segments
path_from_text
path_pat

Returns a BindPat if the path has just one segment, a PathPat otherwise.

path_qualified
path_segment
path_segment_crate
path_segment_self
path_segment_super
path_unqualified
record_expr
record_expr_field
record_expr_field_list
record_field
record_field_list
record_pat
record_pat_field
record_pat_field_list
record_pat_with_fields
ret_type
struct_
token
tuple_field
tuple_field_list
tuple_pat

Creates a tuple of patterns from an iterator of patterns.

tuple_struct_pat
ty
ty_path
ty_ref
ty_tuple
ty_unit
type_param
use_
use_tree
use_tree_glob
use_tree_list
variant
visibility_pub
visibility_pub_crate
where_clause
where_pred
wildcard_pat