mirror of
https://github.com/actix/actix-extras.git
synced 2025-09-03 05:19:23 +02:00
Deploying to gh-pages from @ 8fd166435f
🚀
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<!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="Source of the Rust file `actix-protobuf/src/lib.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>lib.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../../normalize.css"><link rel="stylesheet" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../../ayu.css" disabled><link rel="stylesheet" href="../../dark.css" disabled><link rel="stylesheet" href="../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../storage.js"></script><script defer src="../../source-script.js"></script><script defer src="../../source-files.js"></script><script defer src="../../main.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.svg"></head><body class="rustdoc source"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><main><div class="width-limiter"><nav class="sub"><a class="sub-logo-container" href="../../actix_protobuf/index.html"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></a><form class="search-form"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div></form></nav><section id="main-content" class="content"><div class="example-wrap"><pre class="src-line-numbers"><span id="1">1</span>
|
||||
<!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="Source of the Rust file `actix-protobuf/src/lib.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>lib.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-1f7d512b176f0f72.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/SourceSerif4-Bold-124a1ca42af929b6.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-ef244fc9943488f7.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../../static.files/light-c11f492748536797.css"><link rel="stylesheet" disabled href="../../static.files/dark-a78f946771c40031.css"><link rel="stylesheet" disabled href="../../static.files/ayu-70b683d68cb31790.css"><script id="default-settings" ></script><script src="../../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../../static.files/source-script-74087aa2e88f4475.js"></script><script defer src="../../source-files.js"></script><script defer src="../../static.files/main-0dede64717b247ca.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-201a7e04dc4c6fce.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 source"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"></nav><main><div class="width-limiter"><nav class="sub"><a class="sub-logo-container" href="../../actix_protobuf/index.html"><img class="rust-logo" src="../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><form class="search-form"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</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-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="example-wrap"><pre class="src-line-numbers"><span id="1">1</span>
|
||||
<span id="2">2</span>
|
||||
<span id="3">3</span>
|
||||
<span id="4">4</span>
|
||||
@@ -335,7 +335,7 @@
|
||||
<span id="335">335</span>
|
||||
</pre><pre class="rust"><code><span class="doccomment">//! Protobuf payload extractor for Actix Web.
|
||||
|
||||
</span><span class="attribute">#![forbid(unsafe_code)]
|
||||
</span><span class="attr">#![forbid(unsafe_code)]
|
||||
#![deny(rust_2018_idioms, nonstandard_style)]
|
||||
#![warn(future_incompatible)]
|
||||
|
||||
@@ -363,26 +363,26 @@
|
||||
};
|
||||
<span class="kw">use </span>prost::{DecodeError <span class="kw">as </span>ProtoBufDecodeError, EncodeError <span class="kw">as </span>ProtoBufEncodeError, Message};
|
||||
|
||||
<span class="attribute">#[derive(Debug, Display)]
|
||||
<span class="attr">#[derive(Debug, Display)]
|
||||
</span><span class="kw">pub enum </span>ProtoBufPayloadError {
|
||||
<span class="doccomment">/// Payload size is bigger than 256k
|
||||
</span><span class="attribute">#[display(fmt = <span class="string">"Payload size is bigger than 256k"</span>)]
|
||||
</span><span class="attr">#[display(fmt = <span class="string">"Payload size is bigger than 256k"</span>)]
|
||||
</span>Overflow,
|
||||
|
||||
<span class="doccomment">/// Content type error
|
||||
</span><span class="attribute">#[display(fmt = <span class="string">"Content type error"</span>)]
|
||||
</span><span class="attr">#[display(fmt = <span class="string">"Content type error"</span>)]
|
||||
</span>ContentType,
|
||||
|
||||
<span class="doccomment">/// Serialize error
|
||||
</span><span class="attribute">#[display(fmt = <span class="string">"ProtoBuf serialize error: {}"</span>, _0)]
|
||||
</span><span class="attr">#[display(fmt = <span class="string">"ProtoBuf serialize error: {}"</span>, _0)]
|
||||
</span>Serialize(ProtoBufEncodeError),
|
||||
|
||||
<span class="doccomment">/// Deserialize error
|
||||
</span><span class="attribute">#[display(fmt = <span class="string">"ProtoBuf deserialize error: {}"</span>, _0)]
|
||||
</span><span class="attr">#[display(fmt = <span class="string">"ProtoBuf deserialize error: {}"</span>, _0)]
|
||||
</span>Deserialize(ProtoBufDecodeError),
|
||||
|
||||
<span class="doccomment">/// Payload error
|
||||
</span><span class="attribute">#[display(fmt = <span class="string">"Error that occur during reading payload: {}"</span>, _0)]
|
||||
</span><span class="attr">#[display(fmt = <span class="string">"Error that occur during reading payload: {}"</span>, _0)]
|
||||
</span>Payload(PayloadError),
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@
|
||||
<span class="kw">type </span>Error = Error;
|
||||
<span class="kw">type </span>Future = LocalBoxFuture<<span class="lifetime">'static</span>, <span class="prelude-ty">Result</span><<span class="self">Self</span>, Error>>;
|
||||
|
||||
<span class="attribute">#[inline]
|
||||
<span class="attr">#[inline]
|
||||
</span><span class="kw">fn </span>from_request(req: <span class="kw-2">&</span>HttpRequest, payload: <span class="kw-2">&mut </span>Payload) -> <span class="self">Self</span>::Future {
|
||||
<span class="kw">let </span>limit = req
|
||||
.app_data::<ProtoBufConfig>()
|
||||
@@ -606,7 +606,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
<span class="attribute">#[cfg(test)]
|
||||
<span class="attr">#[cfg(test)]
|
||||
</span><span class="kw">mod </span>tests {
|
||||
<span class="kw">use </span>actix_web::{http::header, test::TestRequest};
|
||||
|
||||
@@ -626,15 +626,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
<span class="attribute">#[derive(Clone, PartialEq, Eq, Message)]
|
||||
<span class="attr">#[derive(Clone, PartialEq, Eq, Message)]
|
||||
</span><span class="kw">pub struct </span>MyObject {
|
||||
<span class="attribute">#[prost(int32, tag = <span class="string">"1"</span>)]
|
||||
<span class="attr">#[prost(int32, tag = <span class="string">"1"</span>)]
|
||||
</span><span class="kw">pub </span>number: i32,
|
||||
<span class="attribute">#[prost(string, tag = <span class="string">"2"</span>)]
|
||||
<span class="attr">#[prost(string, tag = <span class="string">"2"</span>)]
|
||||
</span><span class="kw">pub </span>name: String,
|
||||
}
|
||||
|
||||
<span class="attribute">#[actix_web::test]
|
||||
<span class="attr">#[actix_web::test]
|
||||
</span><span class="kw">async fn </span>test_protobuf() {
|
||||
<span class="kw">let </span>protobuf = ProtoBuf(MyObject {
|
||||
number: <span class="number">9</span>,
|
||||
@@ -646,7 +646,7 @@
|
||||
<span class="macro">assert_eq!</span>(ct, <span class="string">"application/protobuf"</span>);
|
||||
}
|
||||
|
||||
<span class="attribute">#[actix_web::test]
|
||||
<span class="attr">#[actix_web::test]
|
||||
</span><span class="kw">async fn </span>test_protobuf_message() {
|
||||
<span class="kw">let </span>(req, <span class="kw-2">mut </span>pl) = TestRequest::default().to_http_parts();
|
||||
<span class="kw">let </span>protobuf = ProtoBufMessage::<MyObject>::new(<span class="kw-2">&</span>req, <span class="kw-2">&mut </span>pl).<span class="kw">await</span>;
|
||||
@@ -669,4 +669,4 @@
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="actix_protobuf" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5e9772042 2022-10-29)" ></div></body></html>
|
||||
</section></div></main><div id="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_protobuf" data-themes="" data-resource-suffix="" data-rustdoc-version="1.67.0-nightly (73c9eaf21 2022-11-07)" data-search-js="search-39ee4160c7dc16c9.js" data-settings-js="settings-3a0b9947ba1bd99a.js" data-settings-css="settings-a66f7524084a489a.css" ></div></body></html>
|
Reference in New Issue
Block a user