index.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta name="generator" content="rustdoc">
  7. <meta name="description" content="API documentation for the Rust `visit` mod in crate `syn`.">
  8. <meta name="keywords" content="rust, rustlang, rust-lang, visit">
  9. <title>syn::visit - Rust</title>
  10. <link rel="stylesheet" type="text/css" href="../../normalize.css">
  11. <link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle">
  12. <link rel="stylesheet" type="text/css" href="../../dark.css">
  13. <link rel="stylesheet" type="text/css" href="../../main.css" id="themeStyle">
  14. <script src="../../storage.js"></script>
  15. </head>
  16. <body class="rustdoc mod">
  17. <!--[if lte IE 8]>
  18. <div class="warning">
  19. This old browser is unsupported and will most likely display funky
  20. things.
  21. </div>
  22. <![endif]-->
  23. <nav class="sidebar">
  24. <div class="sidebar-menu">&#9776;</div>
  25. <p class='location'>Module visit</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></div><p class='location'><a href='../index.html'>syn</a></p><script>window.sidebarCurrent = {name: 'visit', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div>
  26. </nav>
  27. <div class="theme-picker">
  28. <button id="theme-picker" aria-label="Pick another theme!">
  29. <img src="../../brush.svg" width="18" alt="Pick another theme!">
  30. </button>
  31. <div id="theme-choices"></div>
  32. </div>
  33. <script src="../../theme.js"></script>
  34. <nav class="sub">
  35. <form class="search-form js-only">
  36. <div class="search-container">
  37. <input class="search-input" name="search"
  38. autocomplete="off"
  39. placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
  40. type="search">
  41. </div>
  42. </form>
  43. </nav>
  44. <section id='main' class="content">
  45. <h1 class='fqn'><span class='in-band'>Module <a href='../index.html'>syn</a>::<wbr><a class="mod" href=''>visit</a></span><span class='out-of-band'><span id='render-detail'>
  46. <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
  47. [<span class='inner'>&#x2212;</span>]
  48. </a>
  49. </span><a class='srclink' href='../../src/syn/visit.rs.html#3-778' title='goto source code'>[src]</a></span></h1>
  50. <div class='docblock'><p>AST walker. Each overridden visit method has full control over what
  51. happens with its node, it can do its own traversal of the node's children,
  52. call <code>visit::walk_*</code> to apply the default traversal algorithm, or prevent
  53. deeper traversal by doing nothing.</p>
  54. <p>Note: it is an important invariant that the default visitor walks the body
  55. of a function in &quot;execution order&quot; (more concretely, reverse post-order
  56. with respect to the CFG implied by the AST), meaning that if AST node A may
  57. execute before AST node B, then A is visited first. The borrow checker in
  58. particular relies on this property.</p>
  59. <p>Note: walking an AST before macro expansion is probably a bad idea. For
  60. instance, a walker looking for item names in a module will miss all of
  61. those that are created by the expansion of a macro.</p>
  62. </div><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
  63. <table>
  64. <tr class=' module-item'>
  65. <td><a class="trait" href="trait.Visitor.html"
  66. title='trait syn::visit::Visitor'>Visitor</a></td>
  67. <td class='docblock-short'>
  68. <p>Each method of the Visitor trait is a hook to be potentially
  69. overridden. Each method's default implementation recursively visits
  70. the substructure of the input via the corresponding <code>walk</code> method;
  71. e.g. the <code>visit_mod</code> method by default calls <code>visit::walk_mod</code>.</p>
  72. </td>
  73. </tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
  74. <table>
  75. <tr class=' module-item'>
  76. <td><a class="fn" href="fn.walk_assoc_type_binding.html"
  77. title='fn syn::visit::walk_assoc_type_binding'>walk_assoc_type_binding</a></td>
  78. <td class='docblock-short'>
  79. </td>
  80. </tr>
  81. <tr class=' module-item'>
  82. <td><a class="fn" href="fn.walk_const_expr.html"
  83. title='fn syn::visit::walk_const_expr'>walk_const_expr</a></td>
  84. <td class='docblock-short'>
  85. </td>
  86. </tr>
  87. <tr class=' module-item'>
  88. <td><a class="fn" href="fn.walk_derive_input.html"
  89. title='fn syn::visit::walk_derive_input'>walk_derive_input</a></td>
  90. <td class='docblock-short'>
  91. </td>
  92. </tr>
  93. <tr class=' module-item'>
  94. <td><a class="fn" href="fn.walk_field.html"
  95. title='fn syn::visit::walk_field'>walk_field</a></td>
  96. <td class='docblock-short'>
  97. </td>
  98. </tr>
  99. <tr class=' module-item'>
  100. <td><a class="fn" href="fn.walk_fn_ret_ty.html"
  101. title='fn syn::visit::walk_fn_ret_ty'>walk_fn_ret_ty</a></td>
  102. <td class='docblock-short'>
  103. </td>
  104. </tr>
  105. <tr class=' module-item'>
  106. <td><a class="fn" href="fn.walk_generics.html"
  107. title='fn syn::visit::walk_generics'>walk_generics</a></td>
  108. <td class='docblock-short'>
  109. </td>
  110. </tr>
  111. <tr class=' module-item'>
  112. <td><a class="fn" href="fn.walk_lifetime_def.html"
  113. title='fn syn::visit::walk_lifetime_def'>walk_lifetime_def</a></td>
  114. <td class='docblock-short'>
  115. </td>
  116. </tr>
  117. <tr class=' module-item'>
  118. <td><a class="fn" href="fn.walk_mac.html"
  119. title='fn syn::visit::walk_mac'>walk_mac</a></td>
  120. <td class='docblock-short'>
  121. </td>
  122. </tr>
  123. <tr class=' module-item'>
  124. <td><a class="fn" href="fn.walk_opt_ident.html"
  125. title='fn syn::visit::walk_opt_ident'>walk_opt_ident</a></td>
  126. <td class='docblock-short'>
  127. </td>
  128. </tr>
  129. <tr class=' module-item'>
  130. <td><a class="fn" href="fn.walk_path.html"
  131. title='fn syn::visit::walk_path'>walk_path</a></td>
  132. <td class='docblock-short'>
  133. </td>
  134. </tr>
  135. <tr class=' module-item'>
  136. <td><a class="fn" href="fn.walk_path_parameters.html"
  137. title='fn syn::visit::walk_path_parameters'>walk_path_parameters</a></td>
  138. <td class='docblock-short'>
  139. </td>
  140. </tr>
  141. <tr class=' module-item'>
  142. <td><a class="fn" href="fn.walk_path_segment.html"
  143. title='fn syn::visit::walk_path_segment'>walk_path_segment</a></td>
  144. <td class='docblock-short'>
  145. </td>
  146. </tr>
  147. <tr class=' module-item'>
  148. <td><a class="fn" href="fn.walk_poly_trait_ref.html"
  149. title='fn syn::visit::walk_poly_trait_ref'>walk_poly_trait_ref</a></td>
  150. <td class='docblock-short'>
  151. </td>
  152. </tr>
  153. <tr class=' module-item'>
  154. <td><a class="fn" href="fn.walk_ty.html"
  155. title='fn syn::visit::walk_ty'>walk_ty</a></td>
  156. <td class='docblock-short'>
  157. </td>
  158. </tr>
  159. <tr class=' module-item'>
  160. <td><a class="fn" href="fn.walk_ty_param_bound.html"
  161. title='fn syn::visit::walk_ty_param_bound'>walk_ty_param_bound</a></td>
  162. <td class='docblock-short'>
  163. </td>
  164. </tr>
  165. <tr class=' module-item'>
  166. <td><a class="fn" href="fn.walk_variant.html"
  167. title='fn syn::visit::walk_variant'>walk_variant</a></td>
  168. <td class='docblock-short'>
  169. </td>
  170. </tr>
  171. <tr class=' module-item'>
  172. <td><a class="fn" href="fn.walk_variant_data.html"
  173. title='fn syn::visit::walk_variant_data'>walk_variant_data</a></td>
  174. <td class='docblock-short'>
  175. </td>
  176. </tr></table></section>
  177. <section id='search' class="content hidden"></section>
  178. <section class="footer"></section>
  179. <aside id="help" class="hidden">
  180. <div>
  181. <h1 class="hidden">Help</h1>
  182. <div class="shortcuts">
  183. <h2>Keyboard Shortcuts</h2>
  184. <dl>
  185. <dt><kbd>?</kbd></dt>
  186. <dd>Show this help dialog</dd>
  187. <dt><kbd>S</kbd></dt>
  188. <dd>Focus the search field</dd>
  189. <dt><kbd>↑</kbd></dt>
  190. <dd>Move up in search results</dd>
  191. <dt><kbd>↓</kbd></dt>
  192. <dd>Move down in search results</dd>
  193. <dt><kbd>↹</kbd></dt>
  194. <dd>Switch tab</dd>
  195. <dt><kbd>&#9166;</kbd></dt>
  196. <dd>Go to active search result</dd>
  197. <dt><kbd>+</kbd></dt>
  198. <dd>Expand all sections</dd>
  199. <dt><kbd>-</kbd></dt>
  200. <dd>Collapse all sections</dd>
  201. </dl>
  202. </div>
  203. <div class="infos">
  204. <h2>Search Tricks</h2>
  205. <p>
  206. Prefix searches with a type followed by a colon (e.g.
  207. <code>fn:</code>) to restrict the search to a given type.
  208. </p>
  209. <p>
  210. Accepted types are: <code>fn</code>, <code>mod</code>,
  211. <code>struct</code>, <code>enum</code>,
  212. <code>trait</code>, <code>type</code>, <code>macro</code>,
  213. and <code>const</code>.
  214. </p>
  215. <p>
  216. Search functions by type signature (e.g.
  217. <code>vec -> usize</code> or <code>* -> vec</code>)
  218. </p>
  219. </div>
  220. </div>
  221. </aside>
  222. <script>
  223. window.rootPath = "../../";
  224. window.currentCrate = "syn";
  225. </script>
  226. <script src="../../main.js"></script>
  227. <script defer src="../../search-index.js"></script>
  228. </body>
  229. </html>