pub struct SyntaxFactory { /* private fields */ }
Implementations§
source§impl SyntaxFactory
impl SyntaxFactory
pub fn name(&self, name: &str) -> Name
pub fn ty(&self, text: &str) -> Type
pub fn ty_infer(&self) -> InferType
pub fn type_param(&self, name: Name, bounds: Option<TypeBoundList>) -> TypeParam
pub fn ident_pat(&self, ref_: bool, mut_: bool, name: Name) -> IdentPat
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_bin(&self, lhs: Expr, op: BinaryOp, rhs: Expr) -> BinExpr
pub fn expr_path(&self, path: Path) -> Expr
pub fn expr_ref(&self, expr: Expr, exclusive: bool) -> Expr
pub fn expr_return(&self, expr: Option<Expr>) -> ReturnExpr
pub fn let_stmt( &self, pattern: Pat, ty: Option<Type>, initializer: Option<Expr>, ) -> LetStmt
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 turbofish_generic_arg_list( &self, generic_args: impl IntoIterator<Item = GenericArg>, ) -> 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
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