edlang/syn/punctuated/index.html

18 lines
7.4 KiB
HTML
Raw Normal View History

<!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="A punctuated sequence of syntax tree nodes separated by punctuation."><title>syn::punctuated - Rust</title><script> if (window.location.protocol !== "file:") document.write(`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2">`)</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-e935ef01ae1c1829.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="syn" data-themes="" data-resource-suffix="" data-rustdoc-version="1.78.0 (9b00956e5 2024-04-29)" data-channel="1.78.0" data-search-js="search-42d8da7a6b9792c2.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-4c98445ec4002617.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-12cf3b4f4f9dc36d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-04d5337699b92874.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.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="../../syn/index.html">syn</a><span class="version">2.0.60</span></h2></div><h2 class="location"><a href="#">Module punctuated</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li></ul></section><h2><a href="../index.html">In crate syn</a></h2></div></nav><div class="sidebar-resizer"></div>
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../syn/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../index.html">syn</a>::<wbr><a class="mod" href="#">punctuated</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../src/syn/punctuated.rs.html#1-1109">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A punctuated sequence of syntax tree nodes separated by punctuation.</p>
<p>Lots of things in Rust are punctuated sequences.</p>
<ul>
<li>The fields of a struct are <code>Punctuated&lt;Field, Token![,]&gt;</code>.</li>
<li>The segments of a path are <code>Punctuated&lt;PathSegment, Token![::]&gt;</code>.</li>
<li>The bounds on a generic parameter are <code>Punctuated&lt;TypeParamBound, Token![+]&gt;</code>.</li>
<li>The arguments to a function call are <code>Punctuated&lt;Expr, Token![,]&gt;</code>.</li>
</ul>
<p>This module provides a common representation for these punctuated sequences
in the form of the <a href="struct.Punctuated.html" title="struct syn::punctuated::Punctuated"><code>Punctuated&lt;T, P&gt;</code></a> type. We store a vector of pairs of
syntax tree node + punctuation, where every node in the sequence is followed
by punctuation except for possibly the final one.</p>
<div class="example-wrap"><pre class="language-text"><code>a_function_call(arg1, arg2, arg3);
~~~~^ ~~~~^ ~~~~
</code></pre></div></div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.IntoIter.html" title="struct syn::punctuated::IntoIter">IntoIter</a></div><div class="desc docblock-short">An iterator over owned values of type <code>T</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.IntoPairs.html" title="struct syn::punctuated::IntoPairs">IntoPairs</a></div><div class="desc docblock-short">An iterator over owned pairs of type <code>Pair&lt;T, P&gt;</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.Iter.html" title="struct syn::punctuated::Iter">Iter</a></div><div class="desc docblock-short">An iterator over borrowed values of type <code>&amp;T</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.IterMut.html" title="struct syn::punctuated::IterMut">IterMut</a></div><div class="desc docblock-short">An iterator over mutably borrowed values of type <code>&amp;mut T</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.Pairs.html" title="struct syn::punctuated::Pairs">Pairs</a></div><div class="desc docblock-short">An iterator over borrowed pairs of type <code>Pair&lt;&amp;T, &amp;P&gt;</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.PairsMut.html" title="struct syn::punctuated::PairsMut">PairsMut</a></div><div class="desc docblock-short">An iterator over mutably borrowed pairs of type <code>Pair&lt;&amp;mut T, &amp;mut P&gt;</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.Punctuated.html" title="struct syn::punctuated::Punctuated">Punctuated</a></div><div class="desc docblock-short"><strong>A punctuated sequence of syntax tree nodes of type <code>T</code> separated by
punctuation of type <code>P</code>.</strong></div></li></ul><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.Pair.html" title="enum syn::punctuated::Pair">Pair</a></div><div class="desc docblock-short">A single syntax tree node of type <code>T</code> followed by its trailing punctuation
of type <code>P</code> if any.</div></li></ul></section></div></main></body></html>