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:
@@ -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">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <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">></span> <span class="string">"Invalid header value"</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::MissingScheme</span> <span class="op">=</span><span class="op">></span> <span class="string">"Missing authorization scheme"</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::MissingField</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">></span> <span class="string">"Missing header field"</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">></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">></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">></span> <span class="ident">e</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::Invalid</span> => <span class="string">"Invalid header value"</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::MissingScheme</span> => <span class="string">"Missing authorization scheme"</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::MissingField</span>(<span class="kw">_</span>) => <span class="string">"Missing header field"</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::ToStrError</span>(<span class="ident">e</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="ident">e</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::Utf8Error</span>(<span class="ident">e</span>) => <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">&</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">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span>(<span class="kw">dyn</span> <span class="ident">Error</span> <span class="op">+</span> <span class="lifetime">'static</span>)<span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">source</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span>(<span class="kw">dyn</span> <span class="ident">Error</span> <span class="op">+</span> <span class="lifetime">'static</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">></span> <span class="prelude-val">None</span>,
|
||||
<span class="ident">ParseError::MissingScheme</span> <span class="op">=</span><span class="op">></span> <span class="prelude-val">None</span>,
|
||||
<span class="ident">ParseError::MissingField</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">></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">></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">></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">></span> <span class="prelude-val">Some</span>(<span class="ident">e</span>),
|
||||
<span class="ident">ParseError::Invalid</span> => <span class="prelude-val">None</span>,
|
||||
<span class="ident">ParseError::MissingScheme</span> => <span class="prelude-val">None</span>,
|
||||
<span class="ident">ParseError::MissingField</span>(<span class="kw">_</span>) => <span class="prelude-val">None</span>,
|
||||
<span class="ident">ParseError::ToStrError</span>(<span class="ident">e</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="prelude-val">Some</span>(<span class="ident">e</span>),
|
||||
<span class="ident">ParseError::Utf8Error</span>(<span class="ident">e</span>) => <span class="prelude-val">Some</span>(<span class="ident">e</span>),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">From</span><span class="op"><</span><span class="ident">header::ToStrError</span><span class="op">></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">></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>) -> <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"><</span><span class="ident">base64::DecodeError</span><span class="op">></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">></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>) -> <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"><</span><span class="ident">str::Utf8Error</span><span class="op">></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">></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>) -> <span class="self">Self</span> {
|
||||
<span class="ident">ParseError::Utf8Error</span>(<span class="ident">e</span>)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user