Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/ast/syntax_factory/constructors.rs')
| -rw-r--r-- | crates/syntax/src/ast/syntax_factory/constructors.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/syntax/src/ast/syntax_factory/constructors.rs b/crates/syntax/src/ast/syntax_factory/constructors.rs index 1601ff3174..f50cd90ce9 100644 --- a/crates/syntax/src/ast/syntax_factory/constructors.rs +++ b/crates/syntax/src/ast/syntax_factory/constructors.rs @@ -1,4 +1,6 @@ //! Wrappers over [`make`] constructors +use either::Either; + use crate::{ AstNode, NodeOrToken, SyntaxKind, SyntaxNode, SyntaxToken, ast::{ @@ -124,6 +126,14 @@ impl SyntaxFactory { make::ty_fn_ptr(is_unsafe, abi, params, ret_type).clone_for_update() } + pub fn where_pred( + &self, + path: Either<ast::Lifetime, ast::Type>, + bounds: impl IntoIterator<Item = ast::TypeBound>, + ) -> ast::WherePred { + make::where_pred(path, bounds).clone_for_update() + } + pub fn expr_field(&self, receiver: ast::Expr, field: &str) -> ast::FieldExpr { let ast::Expr::FieldExpr(ast) = make::expr_field(receiver.clone(), field).clone_for_update() |