mirror of
https://github.com/actix/actix-extras.git
synced 2025-08-31 19:37:00 +02:00
Deploying to gh-pages from @ 45643d4035
🚀
This commit is contained in:
@@ -650,6 +650,12 @@
|
||||
<span id="650">650</span>
|
||||
<span id="651">651</span>
|
||||
<span id="652">652</span>
|
||||
<span id="653">653</span>
|
||||
<span id="654">654</span>
|
||||
<span id="655">655</span>
|
||||
<span id="656">656</span>
|
||||
<span id="657">657</span>
|
||||
<span id="658">658</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std</span>::{
|
||||
<span class="ident">collections::HashSet</span>, <span class="ident">convert::TryInto</span>, <span class="ident">error::Error</span> <span class="kw">as</span> <span class="ident">StdError</span>, <span class="ident">iter::FromIterator</span>, <span class="ident">rc::Rc</span>,
|
||||
};
|
||||
@@ -747,6 +753,7 @@
|
||||
|
||||
<span class="ident">expose_headers</span>: <span class="ident">AllOrSome::All</span>,
|
||||
<span class="ident">expose_headers_baked</span>: <span class="prelude-val">None</span>,
|
||||
|
||||
<span class="ident">max_age</span>: <span class="prelude-val">Some</span>(<span class="number">3600</span>),
|
||||
<span class="ident">preflight</span>: <span class="bool-val">true</span>,
|
||||
<span class="ident">send_wildcard</span>: <span class="bool-val">false</span>,
|
||||
@@ -1196,13 +1203,18 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Only call when values are guaranteed to be valid header values and set is not empty.</span>
|
||||
<span class="kw">fn</span> <span class="ident">intersperse_header_values</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="ident">val_set</span>: <span class="kw-2">&</span><span class="ident">HashSet</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>) -> <span class="ident">HeaderValue</span>
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">intersperse_header_values</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="ident">val_set</span>: <span class="kw-2">&</span><span class="ident">HashSet</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>) -> <span class="ident">HeaderValue</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">AsRef</span><span class="op"><</span><span class="ident">str</span><span class="op">></span>,
|
||||
{
|
||||
<span class="macro">debug_assert!</span>(
|
||||
<span class="op">!</span><span class="ident">val_set</span>.<span class="ident">is_empty</span>(),
|
||||
<span class="string">"only call `intersperse_header_values` when set is not empty"</span>
|
||||
);
|
||||
|
||||
<span class="ident">val_set</span>
|
||||
.<span class="ident">iter</span>()
|
||||
.<span class="ident">fold</span>(<span class="ident">String::with_capacity</span>(<span class="number">32</span>), <span class="op">|</span><span class="kw-2">mut</span> <span class="ident">acc</span>, <span class="ident">val</span><span class="op">|</span> {
|
||||
.<span class="ident">fold</span>(<span class="ident">String::with_capacity</span>(<span class="number">64</span>), <span class="op">|</span><span class="kw-2">mut</span> <span class="ident">acc</span>, <span class="ident">val</span><span class="op">|</span> {
|
||||
<span class="ident">acc</span>.<span class="ident">push_str</span>(<span class="string">", "</span>);
|
||||
<span class="ident">acc</span>.<span class="ident">push_str</span>(<span class="ident">val</span>.<span class="ident">as_ref</span>());
|
||||
<span class="ident">acc</span>
|
||||
|
Reference in New Issue
Block a user