pub struct SyntaxFactory { /* private fields */ }Implementations§
Source§impl SyntaxFactory
impl SyntaxFactory
pub fn name(&self, name: &str) -> Name
pub fn name_ref(&self, name: &str) -> NameRef
pub fn lifetime(&self, text: &str) -> Lifetime
pub fn ty(&self, text: &str) -> Type
pub fn ty_infer(&self) -> InferType
pub fn ty_path(&self, path: Path) -> PathType
pub fn type_param(&self, name: Name, bounds: Option<TypeBoundList>) -> TypeParam
pub fn path_segment(&self, name_ref: NameRef) -> PathSegment
pub fn path_segment_generics( &self, name_ref: NameRef, generic_arg_list: GenericArgList, ) -> PathSegment
pub fn path_unqualified(&self, segment: PathSegment) -> Path
pub fn path_from_segments( &self, segments: impl IntoIterator<Item = PathSegment>, is_abs: bool, ) -> Path
pub fn ident_pat(&self, ref_: bool, mut_: bool, name: Name) -> IdentPat
pub fn wildcard_pat(&self) -> WildcardPat
pub fn literal_pat(&self, text: &str) -> LiteralPat
pub fn slice_pat(&self, pats: impl IntoIterator<Item = Pat>) -> SlicePat
pub fn tuple_pat(&self, pats: impl IntoIterator<Item = Pat>) -> TuplePat
pub fn tuple_struct_pat( &self, path: Path, fields: impl IntoIterator<Item = Pat>, ) -> TupleStructPat
pub fn record_pat_with_fields( &self, path: Path, fields: RecordPatFieldList, ) -> RecordPat
pub fn record_pat_field_list( &self, fields: impl IntoIterator<Item = RecordPatField>, rest_pat: Option<RestPat>, ) -> RecordPatFieldList
pub fn record_pat_field(self, name_ref: NameRef, pat: Pat) -> RecordPatField
pub fn record_pat_field_shorthand(&self, name_ref: NameRef) -> RecordPatField
pub fn path_pat(&self, path: Path) -> Pat
pub fn block_expr( &self, statements: impl IntoIterator<Item = Stmt>, tail_expr: Option<Expr>, ) -> BlockExpr
pub fn expr_empty_block(&self) -> BlockExpr
pub fn expr_paren(&self, expr: Expr) -> ParenExpr
pub fn expr_tuple(&self, fields: impl IntoIterator<Item = Expr>) -> TupleExpr
pub fn expr_bin(&self, lhs: Expr, op: BinaryOp, rhs: Expr) -> BinExpr
pub fn expr_literal(&self, text: &str) -> Literal
pub fn expr_path(&self, path: Path) -> Expr
pub fn expr_prefix(&self, op: SyntaxKind, expr: Expr) -> PrefixExpr
pub fn expr_call(&self, expr: Expr, arg_list: ArgList) -> CallExpr
pub fn expr_method_call( &self, receiver: Expr, method: NameRef, arg_list: ArgList, ) -> MethodCallExpr
pub fn arg_list(&self, args: impl IntoIterator<Item = Expr>) -> ArgList
pub fn expr_ref(&self, expr: Expr, exclusive: bool) -> Expr
pub fn expr_closure( &self, pats: impl IntoIterator<Item = Param>, expr: Expr, ) -> ClosureExpr
pub fn expr_return(&self, expr: Option<Expr>) -> ReturnExpr
pub fn expr_if( &self, condition: Expr, then_branch: BlockExpr, else_branch: Option<ElseBranch>, ) -> IfExpr
pub fn expr_let(&self, pattern: Pat, expr: Expr) -> LetExpr
pub fn expr_stmt(&self, expr: Expr) -> ExprStmt
pub fn expr_match(&self, expr: Expr, match_arm_list: MatchArmList) -> MatchExpr
pub fn match_arm( &self, pat: Pat, guard: Option<MatchGuard>, expr: Expr, ) -> MatchArm
pub fn match_guard(&self, condition: Expr) -> MatchGuard
pub fn match_arm_list( &self, match_arms: impl IntoIterator<Item = MatchArm>, ) -> MatchArmList
pub fn let_stmt( &self, pattern: Pat, ty: Option<Type>, initializer: Option<Expr>, ) -> LetStmt
pub fn type_arg(&self, ty: Type) -> TypeArg
pub fn lifetime_arg(&self, lifetime: Lifetime) -> LifetimeArg
pub fn item_const( &self, visibility: Option<Visibility>, name: Name, ty: Type, expr: Expr, ) -> Const
pub fn item_static( &self, visibility: Option<Visibility>, is_unsafe: bool, is_mut: bool, name: Name, ty: Type, expr: Option<Expr>, ) -> Static
pub fn param(&self, pat: Pat, ty: Type) -> Param
pub fn generic_arg_list( &self, generic_args: impl IntoIterator<Item = GenericArg>, is_turbo: bool, ) -> GenericArgList
pub fn record_expr_field( &self, name: NameRef, expr: Option<Expr>, ) -> RecordExprField
pub fn record_field_list( &self, fields: impl IntoIterator<Item = RecordField>, ) -> RecordFieldList
pub fn record_field( &self, visibility: Option<Visibility>, name: Name, ty: Type, ) -> RecordField
pub fn tuple_field_list( &self, fields: impl IntoIterator<Item = TupleField>, ) -> TupleFieldList
pub fn tuple_field( &self, visibility: Option<Visibility>, ty: Type, ) -> TupleField
pub fn item_enum( &self, visibility: Option<Visibility>, name: Name, generic_param_list: Option<GenericParamList>, where_clause: Option<WhereClause>, variant_list: VariantList, ) -> Enum
pub fn variant_list( &self, variants: impl IntoIterator<Item = Variant>, ) -> VariantList
pub fn variant( &self, visibility: Option<Visibility>, name: Name, field_list: Option<FieldList>, discriminant: Option<Expr>, ) -> Variant
pub fn fn_( &self, visibility: Option<Visibility>, fn_name: Name, type_params: Option<GenericParamList>, where_clause: Option<WhereClause>, params: ParamList, body: BlockExpr, ret_type: Option<RetType>, is_async: bool, is_const: bool, is_unsafe: bool, is_gen: bool, ) -> Fn
pub fn token_tree( &self, delimiter: SyntaxKind, tt: impl IntoIterator<Item = NodeOrToken<TokenTree, SyntaxToken<RustLanguage>>>, ) -> TokenTree
pub fn token(&self, kind: SyntaxKind) -> SyntaxToken<RustLanguage>
pub fn whitespace(&self, text: &str) -> SyntaxToken<RustLanguage>
Source§impl SyntaxFactory
impl SyntaxFactory
Source§impl SyntaxFactory
impl SyntaxFactory
Sourcepub fn new() -> SyntaxFactory
pub fn new() -> SyntaxFactory
Creates a new SyntaxFactory, generating mappings between input nodes and generated nodes.
Sourcepub fn without_mappings() -> SyntaxFactory
pub fn without_mappings() -> SyntaxFactory
Creates a SyntaxFactory without generating mappings.
Sourcepub fn finish_with_mappings(self) -> SyntaxMapping
pub fn finish_with_mappings(self) -> SyntaxMapping
Gets all of the tracked syntax mappings, if any.
Sourcepub fn take(&self) -> SyntaxMapping
pub fn take(&self) -> SyntaxMapping
Take all of the tracked syntax mappings, leaving SyntaxMapping::default() in its place, if any.
Trait Implementations§
Source§impl Default for SyntaxFactory
impl Default for SyntaxFactory
Source§fn default() -> SyntaxFactory
fn default() -> SyntaxFactory
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for SyntaxFactory
impl !RefUnwindSafe for SyntaxFactory
impl !Send for SyntaxFactory
impl !Sync for SyntaxFactory
impl !UnwindSafe for SyntaxFactory
impl Unpin for SyntaxFactory
impl UnsafeUnpin for SyntaxFactory
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