mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
14 lines
23 KiB
HTML
14 lines
23 KiB
HTML
|
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="This module contains free-standing functions for creating AST fragments out of smaller pieces."><title>syntax::ast::make - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="syntax" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../syntax/index.html">syntax</a><span class="version">0.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module make</a></h2><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In syntax::<wbr>ast</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../../index.html">syntax</a>::<wbr><a href="../index.html">ast</a></span><h1>Module <span>make</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/syntax/ast/make.rs.html#1-1365">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This module contains free-standing functions for creating AST fragments out
|
|||
|
of smaller pieces.</p>
|
|||
|
<p>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 <code>ext</code> submodule.</p>
|
|||
|
<p>Keep in mind that <code>from_text</code> functions should be kept private. The public
|
|||
|
API should require to assemble every node piecewise. The trick of
|
|||
|
<code>parse(format!())</code> we use internally is an implementation detail – long
|
|||
|
term, it will be replaced with <code>quote!</code>. Do not add more usages to <code>from_text</code> -
|
|||
|
use <code>quote!</code> instead.</p>
|
|||
|
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="ext/index.html" title="mod syntax::ast::make::ext">ext</a></div><div class="desc docblock-short">While the parent module defines basic atomic “constructors”, the <code>ext</code>
|
|||
|
module defines shortcuts for common things.</div></li><li><div class="item-name"><a class="mod" href="tokens/index.html" title="mod syntax::ast::make::tokens">tokens</a></div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.arg_list.html" title="fn syntax::ast::make::arg_list">arg_<wbr>list</a></div></li><li><div class="item-name"><a class="fn" href="fn.assoc_item_list.html" title="fn syntax::ast::make::assoc_item_list">assoc_<wbr>item_<wbr>list</a></div></li><li><div class="item-name"><a class="fn" href="fn.async_move_block_expr.html" title="fn syntax::ast::make::async_move_block_expr">async_<wbr>move_<wbr>block_<wbr>expr</a></div></li><li><div class="item-name"><a class="fn" href="fn.attr_inner.html" title="fn syntax::ast::make::attr_inner">attr_<wbr>inner</a></div></li><li><div class="item-name"><a class="fn" href="fn.attr_outer.html" title="fn syntax::ast::make::attr_outer">attr_<wbr>outer</a></div></li><li><div class="item-name"><a class="fn" href="fn.block_expr.html" title="fn syntax::ast::make::block_expr">block_<wbr>expr</a></div></li><li><div class="item-name"><a class="fn" href="fn.const_param.html" title="fn syntax::ast::make::const_param">const_<wbr>param</a></div></li><li><div class="item-name"><a class="fn" href="fn.enum_.html" title="fn syntax::ast::make::enum_">enum_</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_assignment.html" title="fn syntax::ast::make::expr_assignment">expr_<wbr>assignment</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_await.html" title="fn syntax::ast::make::expr_await">expr_<wbr>await</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_bin_op.html" title="fn syntax::ast::make::expr_bin_op">expr_<wbr>bin_<wbr>op</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_break.html" title="fn syntax::ast::make::expr_break">expr_<wbr>break</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_call.html" title="fn syntax::ast::make::expr_call">expr_<wbr>call</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_closure.html" title="fn syntax::ast::make::expr_closure">expr_<wbr>closure</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_const_value.html" title="fn syntax::ast::make::expr_const_value">expr_<wbr>const_<wbr>value</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_continue.html" title="fn syntax::ast::make::expr_continue">expr_<wbr>continue</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_empty_block.html" title="fn syntax::ast::make::expr_empty_block">expr_<wbr>empty_<wbr>block</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_field.html" title="fn syntax::ast::make::expr_field">expr_<wbr>field</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_for_loop.html" title="fn syntax::ast::make::expr_for_loop">expr_<wbr>for_<wbr>loop</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_if.html" title="fn syntax::ast::make::expr_if">expr_if</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_let.html" title="fn syntax::ast::make::expr_let">expr_<wbr>let</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_literal.html" title="fn syntax::ast::make::expr_literal">expr_<wbr>literal</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_loop.html" title="fn syntax::ast::make::expr_loop">expr_<wbr>loop</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_macro_call.html" title="fn syntax::ast::make::expr_macro_call">expr_<wbr>macro_<wbr>call</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_match.html" title="fn syntax::ast::make::expr_match">expr_<wbr>match</a></div></li><li><div class="item-name"><a class="fn" href="fn.expr_method_call.html" title="fn syntax::ast::make::expr_method_call">expr_<wbr>method_<wbr>call</a></div></li><li><div class="item-name"><a class="fn"
|
|||
|
Type paths allow them but they are often omitted, while expression/pattern paths require them.</div></li><li><div class="item-name"><a class="fn" href="fn.hacky_block_expr.html" title="fn syntax::ast::make::hacky_block_expr">hacky_<wbr>block_<wbr>expr</a></div><div class="desc docblock-short">Ideally this function wouldn’t exist since it involves manual indenting.
|
|||
|
It differs from <code>make::block_expr</code> by also supporting comments and whitespace.</div></li><li><div class="item-name"><a class="fn" href="fn.ident_pat.html" title="fn syntax::ast::make::ident_pat">ident_<wbr>pat</a></div></li><li><div class="item-name"><a class="fn" href="fn.impl_.html" title="fn syntax::ast::make::impl_">impl_</a></div></li><li><div class="item-name"><a class="fn" href="fn.impl_trait.html" title="fn syntax::ast::make::impl_trait">impl_<wbr>trait</a></div></li><li><div class="item-name"><a class="fn" href="fn.impl_trait_type.html" title="fn syntax::ast::make::impl_trait_type">impl_<wbr>trait_<wbr>type</a></div></li><li><div class="item-name"><a class="fn" href="fn.item_const.html" title="fn syntax::ast::make::item_const">item_<wbr>const</a></div></li><li><div class="item-name"><a class="fn" href="fn.item_static.html" title="fn syntax::ast::make::item_static">item_<wbr>static</a></div></li><li><div class="item-name"><a class="fn" href="fn.join_paths.html" title="fn syntax::ast::make::join_paths">join_<wbr>paths</a></div></li><li><div class="item-name"><a class="fn" href="fn.let_else_stmt.html" title="fn syntax::ast::make::let_else_stmt">let_<wbr>else_<wbr>stmt</a></div></li><li><div class="item-name"><a class="fn" href="fn.let_stmt.html" title="fn syntax::ast::make::let_stmt">let_<wbr>stmt</a></div></li><li><div class="item-name"><a class="fn" href="fn.lifetime.html" title="fn syntax::ast::make::lifetime">lifetime</a></div></li><li><div class="item-name"><a class="fn" href="fn.lifetime_arg.html" title="fn syntax::ast::make::lifetime_arg">lifetime_<wbr>arg</a></div></li><li><div class="item-name"><a class="fn" href="fn.lifetime_param.html" title="fn syntax::ast::make::lifetime_param">lifetime_<wbr>param</a></div></li><li><div class="item-name"><a class="fn" href="fn.literal_pat.html" title="fn syntax::ast::make::literal_pat">literal_<wbr>pat</a></div></li><li><div class="item-name"><a class="fn" href="fn.match_arm.html" title="fn syntax::ast::make::match_arm">match_<wbr>arm</a></div></li><li><div class="item-name"><a class="fn" href="fn.match_arm_list.html" title="fn syntax::ast::make::match_arm_list">match_<wbr>arm_<wbr>list</a></div></li><li><div class="item-name"><a class="fn" href="fn.match_arm_with_guard.html" title="fn syntax::ast::make::match_arm_with_guard">match_<wbr>arm_<wbr>with_<wbr>guard</a></div></li><li><div class="item-name"><a class="fn" href="fn.match_guard.html" title="fn syntax::ast::make::match_guard">match_<wbr>guard</a></div></li><li><div class="item-name"><a class="fn" href="fn.meta_expr.html" title="fn syntax::ast::make::meta_expr">meta_<wbr>expr</a></div></li><li><div class="item-name"><a class="fn" href="fn.meta_path.html" title="fn syntax::ast::make::meta_path">meta_<wbr>path</a></div></li><li><div class="item-name"><a class="fn" href="fn.meta_token_tree.html" title="fn syntax::ast::make::meta_token_tree">meta_<wbr>token_<wbr>tree</a></div></li><li><div class="item-name"><a class="fn" href="fn.mut_self_param.html" title="fn syntax::ast::make::mut_self_param">mut_<wbr>self_<wbr>param</a></div></li><li><div class="item-name"><a class="fn" href="fn.name.html" title="fn syntax::ast::make::name">name</a></div></li><li><div class="item-name"><a class="fn" href="fn.name_ref.html" title="fn syntax::ast::make::name_ref">name_<wbr>ref</a></div></li><li><div class="item-name"><a class="fn" href="fn.or_pat.html" title="fn syntax::ast::make::or_pat">or_pat</a></div><div class="desc docblock-short">Returns a <code>Pat</code> if the path has just one segment, an <code>OrPat</code> otherwise.</div></li><li><div class="item-name"><a class="fn" href="fn.param.html" title="fn syntax::ast::make::param">param</a></div></li><li><div class="item-name"><a class="fn" href="fn.param_list.html" title="fn syntax::ast::make::param_list">param_<wbr>list</a></div></li><li><div class="item-name"><a class="fn" href="fn.path_concat.html" title="fn syntax::ast::make::path_concat">path_<wbr>concat</a></div></li><li><div class="item-name"><a class="fn" href="fn.path_from_segments.html" title="fn syntax::a
|