mentat/syn/punctuated/enum.Pair.html
2018-08-22 17:04:13 +00:00

171 lines
No EOL
22 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 `Pair` enum in crate `syn`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Pair">
<title>syn::punctuated::Pair - Rust</title>
<link rel="stylesheet" type="text/css" href="../../normalize.css">
<link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle">
<link rel="stylesheet" type="text/css" href="../../dark.css">
<link rel="stylesheet" type="text/css" href="../../main.css" id="themeStyle">
<script src="../../storage.js"></script>
</head>
<body class="rustdoc enum">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<div class="sidebar-menu">&#9776;</div>
<p class='location'>Enum Pair</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#variants">Variants</a><div class="sidebar-links"><a href="#variant.Punctuated">Punctuated</a><a href="#variant.End">End</a></div><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.into_value">into_value</a><a href="#method.value">value</a><a href="#method.value_mut">value_mut</a><a href="#method.punct">punct</a><a href="#method.new">new</a><a href="#method.into_tuple">into_tuple</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-ToTokens">ToTokens</a><a href="#impl-FromIterator%3CPair%3CT%2C%20P%3E%3E">FromIterator&lt;Pair&lt;T, P&gt;&gt;</a><a href="#impl-Extend%3CPair%3CT%2C%20P%3E%3E">Extend&lt;Pair&lt;T, P&gt;&gt;</a></div></div><p class='location'><a href='../index.html'>syn</a>::<wbr><a href='index.html'>punctuated</a></p><script>window.sidebarCurrent = {name: 'Pair', ty: 'enum', relpath: ''};</script><script defer src="sidebar-items.js"></script></div>
</nav>
<div class="theme-picker">
<button id="theme-picker" aria-label="Pick another theme!">
<img src="../../brush.svg" width="18" alt="Pick another theme!">
</button>
<div id="theme-choices"></div>
</div>
<script src="../../theme.js"></script>
<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'>Enum <a href='../index.html'>syn</a>::<wbr><a href='index.html'>punctuated</a>::<wbr><a class="enum" href=''>Pair</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'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../../src/syn/punctuated.rs.html#572-575' title='goto source code'>[src]</a></span></h1>
<pre class='rust enum'>pub enum Pair&lt;T, P&gt; {
Punctuated(T,&nbsp;P),
End(T),
}</pre><div class='docblock'><p>A single syntax tree node of type <code>T</code> followed by its trailing punctuation
of type <code>P</code> if any.</p>
<p>Refer to the <a href="index.html">module documentation</a> for details about punctuated sequences.</p>
</div><h2 id='variants' class='variants small-section-header'>
Variants<a href='#variants' class='anchor'></a></h2>
<span id="variant.Punctuated" class="variant small-section-header"><a href="#variant.Punctuated" class="anchor field"></a><span id='Punctuated.v' class='invisible'><code>Punctuated(T,&nbsp;P)</code></span></span><span id="variant.End" class="variant small-section-header"><a href="#variant.End" class="anchor field"></a><span id='End.v' class='invisible'><code>End(T)</code></span></span>
<h2 id='methods' class='small-section-header'>
Methods<a href='#methods' class='anchor'></a>
</h2>
<h3 id='impl' class='impl'><span class='in-band'><code>impl&lt;T, P&gt; <a class="enum" href="../../syn/punctuated/enum.Pair.html" title="enum syn::punctuated::Pair">Pair</a>&lt;T, P&gt;</code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/punctuated.rs.html#577-626' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.into_value' class="method"><span id='into_value.v' class='invisible'><code>pub fn <a href='#method.into_value' class='fnname'>into_value</a>(self) -&gt; T</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/punctuated.rs.html#580-584' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Extracts the syntax tree node from this punctuated pair, discarding the
following punctuation.</p>
</div><h4 id='method.value' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, R&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">impl&lt;'a, W&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>W <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;W: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">impl&lt;'a, I&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>I <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a>&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::iterator::Iterator::Item">Item</a>;</span></code></div></div><span id='value.v' class='invisible'><code>pub fn <a href='#method.value' class='fnname'>value</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/punctuated.rs.html#587-591' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Borrows the syntax tree node from this punctuated pair.</p>
</div><h4 id='method.value_mut' class="method"><div class="important-traits"><div class='tooltip'><span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R</h3><code class="content"><span class="where fmt-newline">impl&lt;'a, R&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>R <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">impl&lt;'a, W&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>W <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;W: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline">impl&lt;'a, I&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut </a>I <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = &lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a>&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::iterator::Iterator::Item">Item</a>;</span></code></div></div><span id='value_mut.v' class='invisible'><code>pub fn <a href='#method.value_mut' class='fnname'>value_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/punctuated.rs.html#594-598' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Mutably borrows the syntax tree node from this punctuated pair.</p>
</div><h4 id='method.punct' class="method"><span id='punct.v' class='invisible'><code>pub fn <a href='#method.punct' class='fnname'>punct</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>P&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/punctuated.rs.html#602-607' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Borrows the punctuation from this punctuated pair, unless this pair is
the final one and there is no trailing punctuation.</p>
</div><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>pub fn <a href='#method.new' class='fnname'>new</a>(t: T, d: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;P&gt;) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/punctuated.rs.html#611-616' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Creates a punctuated pair out of a syntax tree node and an optional
following punctuation.</p>
</div><h4 id='method.into_tuple' class="method"><span id='into_tuple.v' class='invisible'><code>pub fn <a href='#method.into_tuple' class='fnname'>into_tuple</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>T, <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;P&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/punctuated.rs.html#620-625' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Produces this punctuated pair as a tuple of syntax tree node and
optional following punctuation.</p>
</div></div>
<h2 id='implementations' class='small-section-header'>
Trait Implementations<a href='#implementations' class='anchor'></a>
</h2>
<h3 id='impl-ToTokens' class='impl'><span class='in-band'><code>impl&lt;T, P&gt; <a class="trait" href="../../quote/to_tokens/trait.ToTokens.html" title="trait quote::to_tokens::ToTokens">ToTokens</a> for <a class="enum" href="../../syn/punctuated/enum.Pair.html" title="enum syn::punctuated::Pair">Pair</a>&lt;T, P&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../quote/to_tokens/trait.ToTokens.html" title="trait quote::to_tokens::ToTokens">ToTokens</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;P: <a class="trait" href="../../quote/to_tokens/trait.ToTokens.html" title="trait quote::to_tokens::ToTokens">ToTokens</a>,&nbsp;</span></code><a href='#impl-ToTokens' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/punctuated.rs.html#792-806' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.to_tokens' class="method"><span id='to_tokens.v' class='invisible'><code>fn <a href='../../quote/to_tokens/trait.ToTokens.html#tymethod.to_tokens' class='fnname'>to_tokens</a>(&amp;self, tokens: &amp;mut <a class="struct" href="../../proc_macro2/struct.TokenStream.html" title="struct proc_macro2::TokenStream">TokenStream</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/punctuated.rs.html#797-805' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Write <code>self</code> to the given <code>TokenStream</code>. <a href="../../quote/to_tokens/trait.ToTokens.html#tymethod.to_tokens">Read more</a></p>
</div><h4 id='method.into_token_stream' class="method"><span id='into_token_stream.v' class='invisible'><code>fn <a href='../../quote/to_tokens/trait.ToTokens.html#method.into_token_stream' class='fnname'>into_token_stream</a>(self) -&gt; <a class="struct" href="../../proc_macro2/struct.TokenStream.html" title="struct proc_macro2::TokenStream">TokenStream</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/quote/to_tokens.rs.html#65-72' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Convert <code>self</code> directly into a <code>TokenStream</code> object. <a href="../../quote/to_tokens/trait.ToTokens.html#method.into_token_stream">Read more</a></p>
</div></div><h3 id='impl-FromIterator%3CPair%3CT%2C%20P%3E%3E' class='impl'><span class='in-band'><code>impl&lt;T, P&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.FromIterator.html" title="trait core::iter::traits::FromIterator">FromIterator</a>&lt;<a class="enum" href="../../syn/punctuated/enum.Pair.html" title="enum syn::punctuated::Pair">Pair</a>&lt;T, P&gt;&gt; for <a class="struct" href="../../syn/punctuated/struct.Punctuated.html" title="struct syn::punctuated::Punctuated">Punctuated</a>&lt;T, P&gt;</code><a href='#impl-FromIterator%3CPair%3CT%2C%20P%3E%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/punctuated.rs.html#283-289' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.from_iter' class="method"><span id='from_iter.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.FromIterator.html#tymethod.from_iter' class='fnname'>from_iter</a>&lt;I:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a>&lt;Item = <a class="enum" href="../../syn/punctuated/enum.Pair.html" title="enum syn::punctuated::Pair">Pair</a>&lt;T, P&gt;&gt;&gt;(i: I) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/punctuated.rs.html#284-288' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Creates a value from an iterator. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.FromIterator.html#tymethod.from_iter">Read more</a></p>
</div></div><h3 id='impl-Extend%3CPair%3CT%2C%20P%3E%3E' class='impl'><span class='in-band'><code>impl&lt;T, P&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.Extend.html" title="trait core::iter::traits::Extend">Extend</a>&lt;<a class="enum" href="../../syn/punctuated/enum.Pair.html" title="enum syn::punctuated::Pair">Pair</a>&lt;T, P&gt;&gt; for <a class="struct" href="../../syn/punctuated/struct.Punctuated.html" title="struct syn::punctuated::Punctuated">Punctuated</a>&lt;T, P&gt;</code><a href='#impl-Extend%3CPair%3CT%2C%20P%3E%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/punctuated.rs.html#291-308' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.extend' class="method"><span id='extend.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.Extend.html#tymethod.extend' class='fnname'>extend</a>&lt;I:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a>&lt;Item = <a class="enum" href="../../syn/punctuated/enum.Pair.html" title="enum syn::punctuated::Pair">Pair</a>&lt;T, P&gt;&gt;&gt;(&amp;mut self, i: I)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/syn/punctuated.rs.html#292-307' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Extends a collection with the contents of an iterator. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.Extend.html#tymethod.extend">Read more</a></p>
</div></div></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><kbd>?</kbd></dt>
<dd>Show this help dialog</dd>
<dt><kbd>S</kbd></dt>
<dd>Focus the search field</dd>
<dt><kbd></kbd></dt>
<dd>Move up in search results</dd>
<dt><kbd></kbd></dt>
<dd>Move down in search results</dd>
<dt><kbd></kbd></dt>
<dd>Switch tab</dd>
<dt><kbd>&#9166;</kbd></dt>
<dd>Go to active search result</dd>
<dt><kbd>+</kbd></dt>
<dd>Expand all sections</dd>
<dt><kbd>-</kbd></dt>
<dd>Collapse 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>