257 lines
12 KiB
HTML
257 lines
12 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="API documentation for the Rust `visit` mod in crate `syn`.">
|
|||
|
<meta name="keywords" content="rust, rustlang, rust-lang, visit">
|
|||
|
|
|||
|
<title>syn::visit - Rust</title>
|
|||
|
|
|||
|
<link rel="stylesheet" type="text/css" href="../../normalize.css">
|
|||
|
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
|
|||
|
<link rel="stylesheet" type="text/css" href="../../main.css">
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
</head>
|
|||
|
<body class="rustdoc mod">
|
|||
|
<!--[if lte IE 8]>
|
|||
|
<div class="warning">
|
|||
|
This old browser is unsupported and will most likely display funky
|
|||
|
things.
|
|||
|
</div>
|
|||
|
<![endif]-->
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<nav class="sidebar">
|
|||
|
|
|||
|
<p class='location'>Module visit</p><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>
|
|||
|
</nav>
|
|||
|
|
|||
|
<nav class="sub">
|
|||
|
<form class="search-form js-only">
|
|||
|
<div class="search-container">
|
|||
|
<input class="search-input" name="search"
|
|||
|
autocomplete="off"
|
|||
|
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
|||
|
type="search">
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
</nav>
|
|||
|
|
|||
|
<section id='main' class="content">
|
|||
|
<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'>
|
|||
|
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
|||
|
[<span class='inner'>−</span>]
|
|||
|
</a>
|
|||
|
</span><a class='srclink' href='../../src/syn/visit.rs.html#3-778' title='goto source code'>[src]</a></span></h1>
|
|||
|
<div class='docblock'><p>AST walker. Each overridden visit method has full control over what
|
|||
|
happens with its node, it can do its own traversal of the node's children,
|
|||
|
call <code>visit::walk_*</code> to apply the default traversal algorithm, or prevent
|
|||
|
deeper traversal by doing nothing.</p>
|
|||
|
|
|||
|
<p>Note: it is an important invariant that the default visitor walks the body
|
|||
|
of a function in "execution order" (more concretely, reverse post-order
|
|||
|
with respect to the CFG implied by the AST), meaning that if AST node A may
|
|||
|
execute before AST node B, then A is visited first. The borrow checker in
|
|||
|
particular relies on this property.</p>
|
|||
|
|
|||
|
<p>Note: walking an AST before macro expansion is probably a bad idea. For
|
|||
|
instance, a walker looking for item names in a module will miss all of
|
|||
|
those that are created by the expansion of a macro.</p>
|
|||
|
</div><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
|
|||
|
<table>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="trait" href="trait.Visitor.html"
|
|||
|
title='trait syn::visit::Visitor'>Visitor</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
<p>Each method of the Visitor trait is a hook to be potentially
|
|||
|
overridden. Each method's default implementation recursively visits
|
|||
|
the substructure of the input via the corresponding <code>walk</code> method;
|
|||
|
e.g. the <code>visit_mod</code> method by default calls <code>visit::walk_mod</code>.</p>
|
|||
|
</td>
|
|||
|
</tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
|
|||
|
<table>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_assoc_type_binding.html"
|
|||
|
title='fn syn::visit::walk_assoc_type_binding'>walk_assoc_type_binding</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_const_expr.html"
|
|||
|
title='fn syn::visit::walk_const_expr'>walk_const_expr</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_derive_input.html"
|
|||
|
title='fn syn::visit::walk_derive_input'>walk_derive_input</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_field.html"
|
|||
|
title='fn syn::visit::walk_field'>walk_field</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_fn_ret_ty.html"
|
|||
|
title='fn syn::visit::walk_fn_ret_ty'>walk_fn_ret_ty</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_generics.html"
|
|||
|
title='fn syn::visit::walk_generics'>walk_generics</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_lifetime_def.html"
|
|||
|
title='fn syn::visit::walk_lifetime_def'>walk_lifetime_def</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_mac.html"
|
|||
|
title='fn syn::visit::walk_mac'>walk_mac</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_opt_ident.html"
|
|||
|
title='fn syn::visit::walk_opt_ident'>walk_opt_ident</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_path.html"
|
|||
|
title='fn syn::visit::walk_path'>walk_path</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_path_parameters.html"
|
|||
|
title='fn syn::visit::walk_path_parameters'>walk_path_parameters</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_path_segment.html"
|
|||
|
title='fn syn::visit::walk_path_segment'>walk_path_segment</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_poly_trait_ref.html"
|
|||
|
title='fn syn::visit::walk_poly_trait_ref'>walk_poly_trait_ref</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_ty.html"
|
|||
|
title='fn syn::visit::walk_ty'>walk_ty</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_ty_param_bound.html"
|
|||
|
title='fn syn::visit::walk_ty_param_bound'>walk_ty_param_bound</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_variant.html"
|
|||
|
title='fn syn::visit::walk_variant'>walk_variant</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr class=' module-item'>
|
|||
|
<td><a class="fn" href="fn.walk_variant_data.html"
|
|||
|
title='fn syn::visit::walk_variant_data'>walk_variant_data</a></td>
|
|||
|
<td class='docblock-short'>
|
|||
|
|
|||
|
</td>
|
|||
|
</tr></table></section>
|
|||
|
<section id='search' class="content hidden"></section>
|
|||
|
|
|||
|
<section class="footer"></section>
|
|||
|
|
|||
|
<aside id="help" class="hidden">
|
|||
|
<div>
|
|||
|
<h1 class="hidden">Help</h1>
|
|||
|
|
|||
|
<div class="shortcuts">
|
|||
|
<h2>Keyboard Shortcuts</h2>
|
|||
|
|
|||
|
<dl>
|
|||
|
<dt>?</dt>
|
|||
|
<dd>Show this help dialog</dd>
|
|||
|
<dt>S</dt>
|
|||
|
<dd>Focus the search field</dd>
|
|||
|
<dt>⇤</dt>
|
|||
|
<dd>Move up in search results</dd>
|
|||
|
<dt>⇥</dt>
|
|||
|
<dd>Move down in search results</dd>
|
|||
|
<dt>⏎</dt>
|
|||
|
<dd>Go to active search result</dd>
|
|||
|
<dt>+</dt>
|
|||
|
<dd>Collapse/expand all sections</dd>
|
|||
|
</dl>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="infos">
|
|||
|
<h2>Search Tricks</h2>
|
|||
|
|
|||
|
<p>
|
|||
|
Prefix searches with a type followed by a colon (e.g.
|
|||
|
<code>fn:</code>) to restrict the search to a given type.
|
|||
|
</p>
|
|||
|
|
|||
|
<p>
|
|||
|
Accepted types are: <code>fn</code>, <code>mod</code>,
|
|||
|
<code>struct</code>, <code>enum</code>,
|
|||
|
<code>trait</code>, <code>type</code>, <code>macro</code>,
|
|||
|
and <code>const</code>.
|
|||
|
</p>
|
|||
|
|
|||
|
<p>
|
|||
|
Search functions by type signature (e.g.
|
|||
|
<code>vec -> usize</code> or <code>* -> vec</code>)
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</aside>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<script>
|
|||
|
window.rootPath = "../../";
|
|||
|
window.currentCrate = "syn";
|
|||
|
</script>
|
|||
|
<script src="../../main.js"></script>
|
|||
|
<script defer src="../../search-index.js"></script>
|
|||
|
</body>
|
|||
|
</html>
|