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 tuple_struct_pat( &self, path: Path, fields: impl IntoIterator<Item = Pat>, ) -> TupleStructPat
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_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 arg_list(&self, args: impl IntoIterator<Item = Expr>) -> ArgList
pub fn expr_ref(&self, expr: Expr, exclusive: bool) -> Expr
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 generic_arg_list( &self, generic_args: impl IntoIterator<Item = GenericArg>, is_turbo: bool, ) -> GenericArgList
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 token_tree( &self, delimiter: SyntaxKind, tt: impl IntoIterator<Item = NodeOrToken<TokenTree, SyntaxToken>>, ) -> TokenTree
pub fn token(&self, kind: SyntaxKind) -> SyntaxToken
pub fn whitespace(&self, text: &str) -> SyntaxToken
Source§impl SyntaxFactory
impl SyntaxFactory
Source§impl SyntaxFactory
impl SyntaxFactory
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new SyntaxFactory
, generating mappings between input nodes and generated nodes.
Sourcepub fn without_mappings() -> Self
pub fn without_mappings() -> Self
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.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SyntaxFactory
impl !RefUnwindSafe for SyntaxFactory
impl !Send for SyntaxFactory
impl !Sync for SyntaxFactory
impl Unpin for SyntaxFactory
impl !UnwindSafe 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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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