150 lines
17 KiB
HTML
150 lines
17 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 `Visitor` trait in crate `syn`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, Visitor">
|
||
|
||
<title>syn::visit::Visitor - 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 trait">
|
||
<!--[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'>Trait Visitor</p><div class="block items"><ul><li><a href="#provided-methods">Provided Methods</a></li><li><a href="#implementors">Implementors</a></li></ul></div><p class='location'><a href='../index.html'>syn</a>::<wbr><a href='index.html'>visit</a></p><script>window.sidebarCurrent = {name: 'Visitor', ty: 'trait', 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'>Trait <a href='../index.html'>syn</a>::<wbr><a href='index.html'>visit</a>::<wbr><a class="trait" href=''>Visitor</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#29-132' title='goto source code'>[src]</a></span></h1>
|
||
<pre class='rust trait'>pub trait Visitor: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
|
||
fn <a href='#method.visit_ident' class='fnname'>visit_ident</a>(&mut self, _ident: &<a class="struct" href="../../syn/struct.Ident.html" title="struct syn::Ident">Ident</a>) { ... }
|
||
fn <a href='#method.visit_derive_input' class='fnname'>visit_derive_input</a>(&mut self, derive_input: &<a class="struct" href="../../syn/struct.DeriveInput.html" title="struct syn::DeriveInput">DeriveInput</a>) { ... }
|
||
fn <a href='#method.visit_ty' class='fnname'>visit_ty</a>(&mut self, ty: &<a class="enum" href="../../syn/enum.Ty.html" title="enum syn::Ty">Ty</a>) { ... }
|
||
fn <a href='#method.visit_generics' class='fnname'>visit_generics</a>(&mut self, generics: &<a class="struct" href="../../syn/struct.Generics.html" title="struct syn::Generics">Generics</a>) { ... }
|
||
fn <a href='#method.visit_ty_param_bound' class='fnname'>visit_ty_param_bound</a>(&mut self, bound: &<a class="enum" href="../../syn/enum.TyParamBound.html" title="enum syn::TyParamBound">TyParamBound</a>) { ... }
|
||
fn <a href='#method.visit_poly_trait_ref' class='fnname'>visit_poly_trait_ref</a>(<br> &mut self, <br> trait_ref: &<a class="struct" href="../../syn/struct.PolyTraitRef.html" title="struct syn::PolyTraitRef">PolyTraitRef</a>, <br> modifier: &<a class="enum" href="../../syn/enum.TraitBoundModifier.html" title="enum syn::TraitBoundModifier">TraitBoundModifier</a><br> ) { ... }
|
||
fn <a href='#method.visit_variant_data' class='fnname'>visit_variant_data</a>(<br> &mut self, <br> data: &<a class="enum" href="../../syn/enum.VariantData.html" title="enum syn::VariantData">VariantData</a>, <br> _ident: &<a class="struct" href="../../syn/struct.Ident.html" title="struct syn::Ident">Ident</a>, <br> _generics: &<a class="struct" href="../../syn/struct.Generics.html" title="struct syn::Generics">Generics</a><br> ) { ... }
|
||
fn <a href='#method.visit_field' class='fnname'>visit_field</a>(&mut self, field: &<a class="struct" href="../../syn/struct.Field.html" title="struct syn::Field">Field</a>) { ... }
|
||
fn <a href='#method.visit_variant' class='fnname'>visit_variant</a>(&mut self, variant: &<a class="struct" href="../../syn/struct.Variant.html" title="struct syn::Variant">Variant</a>, generics: &<a class="struct" href="../../syn/struct.Generics.html" title="struct syn::Generics">Generics</a>) { ... }
|
||
fn <a href='#method.visit_lifetime' class='fnname'>visit_lifetime</a>(&mut self, _lifetime: &<a class="struct" href="../../syn/struct.Lifetime.html" title="struct syn::Lifetime">Lifetime</a>) { ... }
|
||
fn <a href='#method.visit_lifetime_def' class='fnname'>visit_lifetime_def</a>(&mut self, lifetime: &<a class="struct" href="../../syn/struct.LifetimeDef.html" title="struct syn::LifetimeDef">LifetimeDef</a>) { ... }
|
||
fn <a href='#method.visit_path' class='fnname'>visit_path</a>(&mut self, path: &<a class="struct" href="../../syn/struct.Path.html" title="struct syn::Path">Path</a>) { ... }
|
||
fn <a href='#method.visit_path_segment' class='fnname'>visit_path_segment</a>(&mut self, path_segment: &<a class="struct" href="../../syn/struct.PathSegment.html" title="struct syn::PathSegment">PathSegment</a>) { ... }
|
||
fn <a href='#method.visit_path_parameters' class='fnname'>visit_path_parameters</a>(&mut self, path_parameters: &<a class="enum" href="../../syn/enum.PathParameters.html" title="enum syn::PathParameters">PathParameters</a>) { ... }
|
||
fn <a href='#method.visit_assoc_type_binding' class='fnname'>visit_assoc_type_binding</a>(&mut self, type_binding: &<a class="struct" href="../../syn/struct.TypeBinding.html" title="struct syn::TypeBinding">TypeBinding</a>) { ... }
|
||
fn <a href='#method.visit_attribute' class='fnname'>visit_attribute</a>(&mut self, _attr: &<a class="struct" href="../../syn/struct.Attribute.html" title="struct syn::Attribute">Attribute</a>) { ... }
|
||
fn <a href='#method.visit_fn_ret_ty' class='fnname'>visit_fn_ret_ty</a>(&mut self, ret_ty: &<a class="enum" href="../../syn/enum.FunctionRetTy.html" title="enum syn::FunctionRetTy">FunctionRetTy</a>) { ... }
|
||
fn <a href='#method.visit_const_expr' class='fnname'>visit_const_expr</a>(&mut self, expr: &<a class="enum" href="../../syn/enum.ConstExpr.html" title="enum syn::ConstExpr">ConstExpr</a>) { ... }
|
||
fn <a href='#method.visit_lit' class='fnname'>visit_lit</a>(&mut self, _lit: &<a class="enum" href="../../syn/enum.Lit.html" title="enum syn::Lit">Lit</a>) { ... }
|
||
fn <a href='#method.visit_mac' class='fnname'>visit_mac</a>(&mut self, mac: &<a class="struct" href="../../syn/struct.Mac.html" title="struct syn::Mac">Mac</a>) { ... }
|
||
}</pre><div class='docblock'><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>
|
||
|
||
<p>If you want to ensure that your code handles every variant
|
||
explicitly, you need to override each method. (And you also need
|
||
to monitor future changes to <code>Visitor</code> in case a new method with a
|
||
new default implementation gets introduced.)</p>
|
||
</div>
|
||
<h2 id='provided-methods'>Provided Methods</h2>
|
||
<div class='methods'>
|
||
<h3 id='method.visit_ident' class='method'><span id='visit_ident.v' class='invisible'><code>fn <a href='#method.visit_ident' class='fnname'>visit_ident</a>(&mut self, _ident: &<a class="struct" href="../../syn/struct.Ident.html" title="struct syn::Ident">Ident</a>)</code></span></h3><h3 id='method.visit_derive_input' class='method'><span id='visit_derive_input.v' class='invisible'><code>fn <a href='#method.visit_derive_input' class='fnname'>visit_derive_input</a>(&mut self, derive_input: &<a class="struct" href="../../syn/struct.DeriveInput.html" title="struct syn::DeriveInput">DeriveInput</a>)</code></span></h3><h3 id='method.visit_ty' class='method'><span id='visit_ty.v' class='invisible'><code>fn <a href='#method.visit_ty' class='fnname'>visit_ty</a>(&mut self, ty: &<a class="enum" href="../../syn/enum.Ty.html" title="enum syn::Ty">Ty</a>)</code></span></h3><h3 id='method.visit_generics' class='method'><span id='visit_generics.v' class='invisible'><code>fn <a href='#method.visit_generics' class='fnname'>visit_generics</a>(&mut self, generics: &<a class="struct" href="../../syn/struct.Generics.html" title="struct syn::Generics">Generics</a>)</code></span></h3><h3 id='method.visit_ty_param_bound' class='method'><span id='visit_ty_param_bound.v' class='invisible'><code>fn <a href='#method.visit_ty_param_bound' class='fnname'>visit_ty_param_bound</a>(&mut self, bound: &<a class="enum" href="../../syn/enum.TyParamBound.html" title="enum syn::TyParamBound">TyParamBound</a>)</code></span></h3><h3 id='method.visit_poly_trait_ref' class='method'><span id='visit_poly_trait_ref.v' class='invisible'><code>fn <a href='#method.visit_poly_trait_ref' class='fnname'>visit_poly_trait_ref</a>(<br> &mut self, <br> trait_ref: &<a class="struct" href="../../syn/struct.PolyTraitRef.html" title="struct syn::PolyTraitRef">PolyTraitRef</a>, <br> modifier: &<a class="enum" href="../../syn/enum.TraitBoundModifier.html" title="enum syn::TraitBoundModifier">TraitBoundModifier</a><br>)</code></span></h3><h3 id='method.visit_variant_data' class='method'><span id='visit_variant_data.v' class='invisible'><code>fn <a href='#method.visit_variant_data' class='fnname'>visit_variant_data</a>(<br> &mut self, <br> data: &<a class="enum" href="../../syn/enum.VariantData.html" title="enum syn::VariantData">VariantData</a>, <br> _ident: &<a class="struct" href="../../syn/struct.Ident.html" title="struct syn::Ident">Ident</a>, <br> _generics: &<a class="struct" href="../../syn/struct.Generics.html" title="struct syn::Generics">Generics</a><br>)</code></span></h3><h3 id='method.visit_field' class='method'><span id='visit_field.v' class='invisible'><code>fn <a href='#method.visit_field' class='fnname'>visit_field</a>(&mut self, field: &<a class="struct" href="../../syn/struct.Field.html" title="struct syn::Field">Field</a>)</code></span></h3><h3 id='method.visit_variant' class='method'><span id='visit_variant.v' class='invisible'><code>fn <a href='#method.visit_variant' class='fnname'>visit_variant</a>(&mut self, variant: &<a class="struct" href="../../syn/struct.Variant.html" title="struct syn::Variant">Variant</a>, generics: &<a class="struct" href="../../syn/struct.Generics.html" title="struct syn::Generics">Generics</a>)</code></span></h3><h3 id='method.visit_lifetime' class='method'><span id='visit_lifetime.v' class='invisible'><code>fn <a href='#method.visit_lifetime' class='fnname'>visit_lifetime</a>(&mut self, _lifetime: &<a class="struct" href="../../syn/struct.Lifetime.html" title="struct syn::Lifetime">Lifetime</a>)</code></span></h3><h3 id='method.visit_lifetime_def' class='method'><span id='visit_lifetime_def.v' class='invisible'><code>fn <a href='#method.visit_lifetime_def' class='fnname'>visit_lifetime_def</a>(&mut self, lifetime: &<a class="struct" href="../../syn/struct.LifetimeDef.html" title="struct syn::LifetimeDef">LifetimeDef</a>)</code></span></h3><h3 id='method.visit_path' class='method'><span id='visit_path.v' class='invisible'><code>fn <a href='#method.visit_path' class='fnname'>visit_path</a>(&mut self, path: &<a class="struct" href="../../syn/struct.Path.html" title="struct syn::Path">Path</a>)</code></span></h3><h3 id='method.visit_path_segment' class='method'><span id='visit_path_segment.v' class='invisible'><code>fn <a href='#method.visit_path_segment' class='fnname'>visit_path_segment</a>(&mut self, path_segment: &<a class="struct" href="../../syn/struct.PathSegment.html" title="struct syn::PathSegment">PathSegment</a>)</code></span></h3><h3 id='method.visit_path_parameters' class='method'><span id='visit_path_parameters.v' class='invisible'><code>fn <a href='#method.visit_path_parameters' class='fnname'>visit_path_parameters</a>(&mut self, path_parameters: &<a class="enum" href="../../syn/enum.PathParameters.html" title="enum syn::PathParameters">PathParameters</a>)</code></span></h3><h3 id='method.visit_assoc_type_binding' class='method'><span id='visit_assoc_type_binding.v' class='invisible'><code>fn <a href='#method.visit_assoc_type_binding' class='fnname'>visit_assoc_type_binding</a>(&mut self, type_binding: &<a class="struct" href="../../syn/struct.TypeBinding.html" title="struct syn::TypeBinding">TypeBinding</a>)</code></span></h3><h3 id='method.visit_attribute' class='method'><span id='visit_attribute.v' class='invisible'><code>fn <a href='#method.visit_attribute' class='fnname'>visit_attribute</a>(&mut self, _attr: &<a class="struct" href="../../syn/struct.Attribute.html" title="struct syn::Attribute">Attribute</a>)</code></span></h3><h3 id='method.visit_fn_ret_ty' class='method'><span id='visit_fn_ret_ty.v' class='invisible'><code>fn <a href='#method.visit_fn_ret_ty' class='fnname'>visit_fn_ret_ty</a>(&mut self, ret_ty: &<a class="enum" href="../../syn/enum.FunctionRetTy.html" title="enum syn::FunctionRetTy">FunctionRetTy</a>)</code></span></h3><h3 id='method.visit_const_expr' class='method'><span id='visit_const_expr.v' class='invisible'><code>fn <a href='#method.visit_const_expr' class='fnname'>visit_const_expr</a>(&mut self, expr: &<a class="enum" href="../../syn/enum.ConstExpr.html" title="enum syn::ConstExpr">ConstExpr</a>)</code></span></h3><h3 id='method.visit_lit' class='method'><span id='visit_lit.v' class='invisible'><code>fn <a href='#method.visit_lit' class='fnname'>visit_lit</a>(&mut self, _lit: &<a class="enum" href="../../syn/enum.Lit.html" title="enum syn::Lit">Lit</a>)</code></span></h3><h3 id='method.visit_mac' class='method'><span id='visit_mac.v' class='invisible'><code>fn <a href='#method.visit_mac' class='fnname'>visit_mac</a>(&mut self, mac: &<a class="struct" href="../../syn/struct.Mac.html" title="struct syn::Mac">Mac</a>)</code></span></h3></div>
|
||
<h2 id='implementors'>Implementors</h2>
|
||
<ul class='item-list' id='implementors-list'>
|
||
</ul><script type="text/javascript" async
|
||
src="../../implementors/syn/visit/trait.Visitor.js">
|
||
</script></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> |