171 lines
No EOL
22 KiB
HTML
171 lines
No EOL
22 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 `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">☰</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<Pair<T, P>></a><a href="#impl-Extend%3CPair%3CT%2C%20P%3E%3E">Extend<Pair<T, P>></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'>−</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<T, P> {
|
||
Punctuated(T, 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, 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<T, P> <a class="enum" href="../../syn/punctuated/enum.Pair.html" title="enum syn::punctuated::Pair">Pair</a><T, P></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) -> 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">&'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">&'a mut </a>R</h3><code class="content"><span class="where fmt-newline">impl<'a, R> <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">&'a mut </a>R <span class="where fmt-newline">where<br> 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>, </span></span><span class="where fmt-newline">impl<'a, W> <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">&'a mut </a>W <span class="where fmt-newline">where<br> 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>, </span></span><span class="where fmt-newline">impl<'a, 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> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut </a>I <span class="where fmt-newline">where<br> 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>, </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> = <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>>::<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>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</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">&'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">&'a mut </a>R</h3><code class="content"><span class="where fmt-newline">impl<'a, R> <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">&'a mut </a>R <span class="where fmt-newline">where<br> 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>, </span></span><span class="where fmt-newline">impl<'a, W> <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">&'a mut </a>W <span class="where fmt-newline">where<br> 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>, </span></span><span class="where fmt-newline">impl<'a, 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> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut </a>I <span class="where fmt-newline">where<br> 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>, </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> = <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>>::<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>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&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>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>P></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><P>) -> 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) -> <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><P><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<T, P> <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><T, P> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../quote/to_tokens/trait.ToTokens.html" title="trait quote::to_tokens::ToTokens">ToTokens</a>,<br> P: <a class="trait" href="../../quote/to_tokens/trait.ToTokens.html" title="trait quote::to_tokens::ToTokens">ToTokens</a>, </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>(&self, tokens: &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) -> <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<T, P> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.FromIterator.html" title="trait core::iter::traits::FromIterator">FromIterator</a><<a class="enum" href="../../syn/punctuated/enum.Pair.html" title="enum syn::punctuated::Pair">Pair</a><T, P>> for <a class="struct" href="../../syn/punctuated/struct.Punctuated.html" title="struct syn::punctuated::Punctuated">Punctuated</a><T, P></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><I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a><Item = <a class="enum" href="../../syn/punctuated/enum.Pair.html" title="enum syn::punctuated::Pair">Pair</a><T, P>>>(i: I) -> 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<T, P> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.Extend.html" title="trait core::iter::traits::Extend">Extend</a><<a class="enum" href="../../syn/punctuated/enum.Pair.html" title="enum syn::punctuated::Pair">Pair</a><T, P>> for <a class="struct" href="../../syn/punctuated/struct.Punctuated.html" title="struct syn::punctuated::Punctuated">Punctuated</a><T, P></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><I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a><Item = <a class="enum" href="../../syn/punctuated/enum.Pair.html" title="enum syn::punctuated::Pair">Pair</a><T, P>>>(&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>⏎</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> |