edlang/winnow/stream/trait.Accumulate.html

16 lines
25 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="Abstracts something which can extend an `Extend`. Used to build modified input slices in `escaped_transform`"><title>Accumulate in winnow::stream - Rust</title><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"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-ac92e1bbe349e143.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="winnow" data-themes="" data-resource-suffix="" data-rustdoc-version="1.76.0 (07dca489a 2024-02-04)" data-channel="1.76.0" data-search-js="search-2b6ce74ff89ae146.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-305769736d49e732.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-feafe1bb7466e4bd.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 trait"><!--[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">&#9776;</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../winnow/index.html">winnow</a><span class="version">0.6.5</span></h2></div><h2 class="location"><a href="#">Accumulate</a></h2><div class="sidebar-elems"><section><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.accumulate">accumulate</a></li><li><a href="#tymethod.initial">initial</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-Accumulate%3CT%3E-for-()">()</a></li><li><a href="#impl-Accumulate%3C(K,+V)%3E-for-BTreeMap%3CK,+V%3E">BTreeMap&lt;K, V&gt;</a></li><li><a href="#impl-Accumulate%3CK%3E-for-BTreeSet%3CK%3E">BTreeSet&lt;K&gt;</a></li><li><a href="#impl-Accumulate%3C(K,+V)%3E-for-HashMap%3CK,+V,+S%3E">HashMap&lt;K, V, S&gt;</a></li><li><a href="#impl-Accumulate%3CK%3E-for-HashSet%3CK,+S%3E">HashSet&lt;K, S&gt;</a></li><li><a href="#impl-Accumulate%3C%26str%3E-for-String">String</a></li><li><a href="#impl-Accumulate%3Cchar%3E-for-String">String</a></li><li><a href="#impl-Accumulate%3C%26%5BT%5D%3E-for-Vec%3CT%3E">Vec&lt;T&gt;</a></li><li><a href="#impl-Accumulate%3CT%3E-for-Vec%3CT%3E">Vec&lt;T&gt;</a></li><li><a href="#impl-Accumulate%3CT%3E-for-usize">usize</a></li></ul><h3><a href="#object-safety">Object Safety</a></h3><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In winnow::stream</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="../../winnow/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>Trait <a href="../index.html">winnow</a>::<wbr><a href="index.html">stream</a>::<wbr><a class="trait" href="#">Accumulate</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/winnow/stream/mod.rs.html#2834-2839">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub trait Accumulate&lt;T&gt;: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
// Required methods
fn <a href="#tymethod.initial" class="fn">initial</a>(capacity: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>&gt;) -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.accumulate" class="fn">accumulate</a>(&amp;mut self, acc: T);
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Abstracts something which can extend an <code>Extend</code>.
Used to build modified input slices in <code>escaped_transform</code></p>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.initial" class="method"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2836">source</a><h4 class="code-header">fn <a href="#tymethod.initial" class="fn">initial</a>(capacity: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Create a new <code>Extend</code> of the correct type</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.accumulate" class="method"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2838">source</a><h4 class="code-header">fn <a href="#tymethod.accumulate" class="fn">accumulate</a>(&amp;mut self, acc: T)</h4></section></summary><div class="docblock"><p>Accumulate the input into an accumulator</p>
</div></details></div><h2 id="object-safety" class="section-header">Object Safety<a href="#object-safety" class="anchor">§</a></h2><div class="object-safety-info">This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.76.0/reference/items/traits.html#object-safety">object safe</a>.</div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-Accumulate%3Cchar%3E-for-String" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2890-2902">source</a><a href="#impl-Accumulate%3Cchar%3E-for-String" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Accumulate.html" title="trait winnow::stream::Accumulate">Accumulate</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.char.html">char</a>&gt; for <a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h3></section></summary><div class="impl-items"><section id="method.initial" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2892-2897">source</a><a href="#method.initial" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.initial" class="fn">initial</a>(capacity: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>&gt;) -&gt; Self</h4></section><section id="method.accumulate" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2899-2901">source</a><a href="#method.accumulate" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.accumulate" class="fn">accumulate</a>(&amp;mut self, acc: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.char.html">char</a>)</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Accumulate%3C%26str%3E-for-String" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2905-2917">source</a><a href="#impl-Accumulate%3C%26str%3E-for-String" class="anchor">§</a><h3 class="code-header">impl&lt;'i&gt; <a class="trait" href="trait.Accumulate.html" title="trait winnow::stream::Accumulate">Accumulate</a>&lt;&amp;'i <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>&gt; for <a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h3></section></summary><div class="impl-items"><section id="method.initial-1" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2907-2912">source</a><a href="#method.initial-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.initial" class="fn">initial</a>(capacity: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>&gt;) -&gt; Self</h4></section><section id="method.accumulate-1" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2914-2916">source</a><a href="#method.accumulate-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.accumulate" class="fn">accumulate</a>(&amp;mut self, acc: &amp;'i <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>)</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Accumulate%3C%26%5BT%5D%3E-for-Vec%3CT%3E" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2875-2887">source</a><a href="#impl-Accumulate%3C%26%5BT%5D%3E-for-Vec%3CT%3E" class="anchor">§</a><h3 class="code-header">im
K: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h3></section></summary><div class="impl-items"><section id="method.initial-3" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2962-2964">source</a><a href="#method.initial-3" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.initial" class="fn">initial</a>(_capacity: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>&gt;) -&gt; Self</h4></section><section id="method.accumulate-3" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2966-2968">source</a><a href="#method.accumulate-3" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.accumulate" class="fn">accumulate</a>(&amp;mut self, key: K)</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Accumulate%3CK%3E-for-HashSet%3CK,+S%3E" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2972-2989">source</a><a href="#impl-Accumulate%3CK%3E-for-HashSet%3CK,+S%3E" class="anchor">§</a><h3 class="code-header">impl&lt;K, S&gt; <a class="trait" href="trait.Accumulate.html" title="trait winnow::stream::Accumulate">Accumulate</a>&lt;K&gt; for <a class="struct" href="https://doc.rust-lang.org/1.76.0/std/collections/hash/set/struct.HashSet.html" title="struct std::collections::hash::set::HashSet">HashSet</a>&lt;K, S&gt;<div class="where">where
K: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,
S: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a>,</div></h3></section></summary><div class="impl-items"><section id="method.initial-4" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2978-2984">source</a><a href="#method.initial-4" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.initial" class="fn">initial</a>(capacity: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>&gt;) -&gt; Self</h4></section><section id="method.accumulate-4" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2986-2988">source</a><a href="#method.accumulate-4" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.accumulate" class="fn">accumulate</a>(&amp;mut self, key: K)</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Accumulate%3C(K,+V)%3E-for-BTreeMap%3CK,+V%3E" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2920-2932">source</a><a href="#impl-Accumulate%3C(K,+V)%3E-for-BTreeMap%3CK,+V%3E" class="anchor">§</a><h3 class="code-header">impl&lt;K, V&gt; <a class="trait" href="trait.Accumulate.html" title="trait winnow::stream::Accumulate">Accumulate</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.tuple.html">(K, V)</a>&gt; for <a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/collections/btree/map/struct.BTreeMap.html" title="struct alloc::collections::btree::map::BTreeMap">BTreeMap</a>&lt;K, V&gt;<div class="where">where
K: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h3></section></summary><div class="impl-items"><section id="method.initial-5" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2925-2927">source</a><a href="#method.initial-5" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.initial" class="fn">initial</a>(_capacity: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>&gt;) -&gt; Self</h4></section><section id="method.accumulate-5" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2929-2931">source</a><a href="#method.accumulate-5" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.accumulate" class="fn">accumulate</a>(&amp;mut self, (key, value): <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.tuple.html">(K, V)</a>)</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Accumulate%3C(K,+V)%3E-for-HashMap%3CK,+V,+S%3E" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2935-2954">source</a><a href="#impl-Accumulate%3C(K,+V)%3E-for-HashMap%3CK,+V,+S%3E" class="anchor">§</a><h3 class="code-header">impl&lt;K, V, S&gt; <a class="trait" href="trait.Accumulate.html" title="trait winnow::stream::Accumulate">Accumulate</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.tuple.html">(K, V)</a>&gt; for <a class="struct" href="https://doc.rust-lang.org/1.76.0/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;K, V, S&gt;<div class="where">where
K: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>,
S: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher">BuildHasher</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a>,</div></h3></section></summary><div class="impl-items"><section id="method.initial-6" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2941-2949">source</a><a href="#method.initial-6" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.initial" class="fn">initial</a>(capacity: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>&gt;) -&gt; Self</h4></section><section id="method.accumulate-6" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2951-2953">source</a><a href="#method.accumulate-6" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.accumulate" class="fn">accumulate</a>(&amp;mut self, (key, value): <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.tuple.html">(K, V)</a>)</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Accumulate%3CT%3E-for-()" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2841-2846">source</a><a href="#impl-Accumulate%3CT%3E-for-()" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.Accumulate.html" title="trait winnow::stream::Accumulate">Accumulate</a>&lt;T&gt; for <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.unit.html">()</a></h3></section></summary><div class="impl-items"><section id="method.initial-7" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2843">source</a><a href="#method.initial-7" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.initial" class="fn">initial</a>(_capacity: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>&gt;) -&gt; Self</h4></section><section id="method.accumulate-7" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2845">source</a><a href="#method.accumulate-7" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.accumulate" class="fn">accumulate</a>(&amp;mut self, _acc: T)</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Accumulate%3CT%3E-for-usize" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2848-2857">source</a><a href="#impl-Accumulate%3CT%3E-for-usize" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.Accumulate.html" title="trait winnow::stream::Accumulate">Accumulate</a>&lt;T&gt; for <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a></h3></section></summary><div class="impl-items"><section id="method.initial-8" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2850-2852">source</a><a href="#method.initial-8" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.initial" class="fn">initial</a>(_capacity: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>&gt;) -&gt; Self</h4></section><section id="method.accumulate-8" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2854-2856">source</a><a href="#method.accumulate-8" class="anchor">§</a><h4 class="code-header">fn <a href="#ty