1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-08-31 03:20:20 +02:00

Deploying to gh-pages from @ 798a5d6d0e 🚀

This commit is contained in:
robjtede
2021-10-11 01:57:28 +00:00
parent 0c14dfbe8c
commit 9210aa9b4c
97 changed files with 1168 additions and 962 deletions

View File

@@ -95,44 +95,44 @@
}
<span class="kw">impl</span> <span class="ident">fmt::Display</span> <span class="kw">for</span> <span class="ident">ParseError</span> {
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op">&lt;</span><span class="lifetime">&#39;_</span><span class="op">&gt;</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">fmt::Result</span> {
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op">&lt;</span><span class="lifetime">&#39;_</span><span class="op">&gt;</span>) -&gt; <span class="ident">fmt::Result</span> {
<span class="kw">let</span> <span class="ident">display</span> <span class="op">=</span> <span class="kw">match</span> <span class="self">self</span> {
<span class="ident">ParseError::Invalid</span> <span class="op">=</span><span class="op">&gt;</span> <span class="string">&quot;Invalid header value&quot;</span>.<span class="ident">to_string</span>(),
<span class="ident">ParseError::MissingScheme</span> <span class="op">=</span><span class="op">&gt;</span> <span class="string">&quot;Missing authorization scheme&quot;</span>.<span class="ident">to_string</span>(),
<span class="ident">ParseError::MissingField</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="string">&quot;Missing header field&quot;</span>.<span class="ident">to_string</span>(),
<span class="ident">ParseError::ToStrError</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">e</span>.<span class="ident">to_string</span>(),
<span class="ident">ParseError::Base64DecodeError</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">e</span>.<span class="ident">to_string</span>(),
<span class="ident">ParseError::Utf8Error</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">e</span>.<span class="ident">to_string</span>(),
<span class="ident">ParseError::Invalid</span> =&gt; <span class="string">&quot;Invalid header value&quot;</span>.<span class="ident">to_string</span>(),
<span class="ident">ParseError::MissingScheme</span> =&gt; <span class="string">&quot;Missing authorization scheme&quot;</span>.<span class="ident">to_string</span>(),
<span class="ident">ParseError::MissingField</span>(<span class="kw">_</span>) =&gt; <span class="string">&quot;Missing header field&quot;</span>.<span class="ident">to_string</span>(),
<span class="ident">ParseError::ToStrError</span>(<span class="ident">e</span>) =&gt; <span class="ident">e</span>.<span class="ident">to_string</span>(),
<span class="ident">ParseError::Base64DecodeError</span>(<span class="ident">e</span>) =&gt; <span class="ident">e</span>.<span class="ident">to_string</span>(),
<span class="ident">ParseError::Utf8Error</span>(<span class="ident">e</span>) =&gt; <span class="ident">e</span>.<span class="ident">to_string</span>(),
};
<span class="ident">f</span>.<span class="ident">write_str</span>(<span class="kw-2">&amp;</span><span class="ident">display</span>)
}
}
<span class="kw">impl</span> <span class="ident">Error</span> <span class="kw">for</span> <span class="ident">ParseError</span> {
<span class="kw">fn</span> <span class="ident">source</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="kw-2">&amp;</span>(<span class="kw">dyn</span> <span class="ident">Error</span> <span class="op">+</span> <span class="lifetime">&#39;static</span>)<span class="op">&gt;</span> {
<span class="kw">fn</span> <span class="ident">source</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="kw-2">&amp;</span>(<span class="kw">dyn</span> <span class="ident">Error</span> <span class="op">+</span> <span class="lifetime">&#39;static</span>)<span class="op">&gt;</span> {
<span class="kw">match</span> <span class="self">self</span> {
<span class="ident">ParseError::Invalid</span> <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">None</span>,
<span class="ident">ParseError::MissingScheme</span> <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">None</span>,
<span class="ident">ParseError::MissingField</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">None</span>,
<span class="ident">ParseError::ToStrError</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Some</span>(<span class="ident">e</span>),
<span class="ident">ParseError::Base64DecodeError</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Some</span>(<span class="ident">e</span>),
<span class="ident">ParseError::Utf8Error</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Some</span>(<span class="ident">e</span>),
<span class="ident">ParseError::Invalid</span> =&gt; <span class="prelude-val">None</span>,
<span class="ident">ParseError::MissingScheme</span> =&gt; <span class="prelude-val">None</span>,
<span class="ident">ParseError::MissingField</span>(<span class="kw">_</span>) =&gt; <span class="prelude-val">None</span>,
<span class="ident">ParseError::ToStrError</span>(<span class="ident">e</span>) =&gt; <span class="prelude-val">Some</span>(<span class="ident">e</span>),
<span class="ident">ParseError::Base64DecodeError</span>(<span class="ident">e</span>) =&gt; <span class="prelude-val">Some</span>(<span class="ident">e</span>),
<span class="ident">ParseError::Utf8Error</span>(<span class="ident">e</span>) =&gt; <span class="prelude-val">Some</span>(<span class="ident">e</span>),
}
}
}
<span class="kw">impl</span> <span class="ident">From</span><span class="op">&lt;</span><span class="ident">header::ToStrError</span><span class="op">&gt;</span> <span class="kw">for</span> <span class="ident">ParseError</span> {
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">e</span>: <span class="ident">header::ToStrError</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="self">Self</span> {
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">e</span>: <span class="ident">header::ToStrError</span>) -&gt; <span class="self">Self</span> {
<span class="ident">ParseError::ToStrError</span>(<span class="ident">e</span>)
}
}
<span class="kw">impl</span> <span class="ident">From</span><span class="op">&lt;</span><span class="ident">base64::DecodeError</span><span class="op">&gt;</span> <span class="kw">for</span> <span class="ident">ParseError</span> {
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">e</span>: <span class="ident">base64::DecodeError</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="self">Self</span> {
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">e</span>: <span class="ident">base64::DecodeError</span>) -&gt; <span class="self">Self</span> {
<span class="ident">ParseError::Base64DecodeError</span>(<span class="ident">e</span>)
}
}
<span class="kw">impl</span> <span class="ident">From</span><span class="op">&lt;</span><span class="ident">str::Utf8Error</span><span class="op">&gt;</span> <span class="kw">for</span> <span class="ident">ParseError</span> {
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">e</span>: <span class="ident">str::Utf8Error</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="self">Self</span> {
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">e</span>: <span class="ident">str::Utf8Error</span>) -&gt; <span class="self">Self</span> {
<span class="ident">ParseError::Utf8Error</span>(<span class="ident">e</span>)
}
}