mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-27 16:52:58 +01:00
Deploying to gh-pages from @ actix/actix-net@af00dada5c 🚀
This commit is contained in:
commit
42c044fa2e
1
actix_codec/all.html
Normal file
1
actix_codec/all.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!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="List of all items in this crate"><title>List of all items in this crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_codec" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod sys"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_codec/index.html">actix_<wbr>codec</a><span class="version">0.5.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h3><a href="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><h1>List of all items</h1><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.BytesCodec.html">BytesCodec</a></li><li><a href="struct.Framed.html">Framed</a></li><li><a href="struct.FramedParts.html">FramedParts</a></li><li><a href="struct.LinesCodec.html">LinesCodec</a></li><li><a href="struct.ReadBuf.html">ReadBuf</a></li></ul><h3 id="traits">Traits</h3><ul class="all-items"><li><a href="trait.AsyncRead.html">AsyncRead</a></li><li><a href="trait.AsyncWrite.html">AsyncWrite</a></li><li><a href="trait.Decoder.html">Decoder</a></li><li><a href="trait.Encoder.html">Encoder</a></li></ul><h3 id="functions">Functions</h3><ul class="all-items"><li><a href="fn.poll_read_buf.html">poll_read_buf</a></li></ul></section></div></main></body></html>
|
11
actix_codec/bcodec/struct.BytesCodec.html
Normal file
11
actix_codec/bcodec/struct.BytesCodec.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_codec/struct.BytesCodec.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_codec/struct.BytesCodec.html">../../actix_codec/struct.BytesCodec.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_codec/struct.BytesCodec.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
35
actix_codec/fn.poll_read_buf.html
Normal file
35
actix_codec/fn.poll_read_buf.html
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<!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="Try to read data from an `AsyncRead` into an implementer of the `BufMut` trait."><title>poll_read_buf in actix_codec - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_codec" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_codec/index.html">actix_<wbr>codec</a><span class="version">0.5.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">poll_<wbr>read_<wbr>buf</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate actix_<wbr>codec</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">actix_codec</a></span><h1>Function <span class="fn">poll_read_buf</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub fn poll_read_buf<T, B>(
|
||||||
|
io: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut T</a>>,
|
||||||
|
cx: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||||||
|
buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut B</a>,
|
||||||
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>><div class="where">where
|
||||||
|
T: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||||||
|
B: BufMut,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Try to read data from an <code>AsyncRead</code> into an implementer of the <a href="bytes::Buf"><code>BufMut</code></a> trait.</p>
|
||||||
|
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::{Bytes, BytesMut};
|
||||||
|
<span class="kw">use </span>tokio_stream <span class="kw">as </span>stream;
|
||||||
|
<span class="kw">use </span>tokio::io::Result;
|
||||||
|
<span class="kw">use </span>tokio_util::io::{StreamReader, poll_read_buf};
|
||||||
|
<span class="kw">use </span>futures::future::poll_fn;
|
||||||
|
<span class="kw">use </span>std::pin::Pin;
|
||||||
|
|
||||||
|
<span class="comment">// Create a reader from an iterator. This particular reader will always be
|
||||||
|
// ready.
|
||||||
|
</span><span class="kw">let </span><span class="kw-2">mut </span>read = StreamReader::new(stream::iter(<span class="macro">vec!</span>[Result::Ok(Bytes::from_static(<span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]))]));
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>buf = BytesMut::new();
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>reads = <span class="number">0</span>;
|
||||||
|
|
||||||
|
<span class="kw">loop </span>{
|
||||||
|
reads += <span class="number">1</span>;
|
||||||
|
<span class="kw">let </span>n = poll_fn(|cx| poll_read_buf(Pin::new(<span class="kw-2">&mut </span>read), cx, <span class="kw-2">&mut </span>buf)).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="kw">if </span>n == <span class="number">0 </span>{
|
||||||
|
<span class="kw">break</span>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="comment">// one or more reads might be necessary.
|
||||||
|
</span><span class="macro">assert!</span>(reads >= <span class="number">1</span>);
|
||||||
|
<span class="macro">assert_eq!</span>(<span class="kw-2">&</span>buf[..], <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]);</code></pre></div>
|
||||||
|
</div></details></section></div></main></body></html>
|
11
actix_codec/framed/struct.Framed.html
Normal file
11
actix_codec/framed/struct.Framed.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_codec/struct.Framed.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_codec/struct.Framed.html">../../actix_codec/struct.Framed.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_codec/struct.Framed.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
11
actix_codec/framed/struct.FramedParts.html
Normal file
11
actix_codec/framed/struct.FramedParts.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_codec/struct.FramedParts.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_codec/struct.FramedParts.html">../../actix_codec/struct.FramedParts.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_codec/struct.FramedParts.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
6
actix_codec/index.html
Normal file
6
actix_codec/index.html
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<!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="Codec utilities for working with framed protocols."><title>actix_codec - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_codec" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod crate"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_codec/index.html">actix_<wbr>codec</a><span class="version">0.5.2</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>actix_codec</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/actix_codec/lib.rs.html#1-28">source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Codec utilities for working with framed protocols.</p>
|
||||||
|
<p>Contains adapters to go from streams of bytes, <a href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead"><code>AsyncRead</code></a> and <a href="trait.AsyncWrite.html" title="trait actix_codec::AsyncWrite"><code>AsyncWrite</code></a>, to framed
|
||||||
|
streams implementing <a href="futures_sink::Sink"><code>Sink</code></a> and <a href="futures_core::Stream"><code>Stream</code></a>. Framed streams are also known as <code>transports</code>.</p>
|
||||||
|
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.BytesCodec.html" title="struct actix_codec::BytesCodec">Bytes<wbr>Codec</a></div><div class="desc docblock-short">Bytes codec. Reads/writes chunks of bytes from a stream.</div></li><li><div class="item-name"><a class="struct" href="struct.Framed.html" title="struct actix_codec::Framed">Framed</a></div><div class="desc docblock-short">A unified <code>Stream</code> and <code>Sink</code> interface to an underlying I/O object, using the <code>Encoder</code> and
|
||||||
|
<code>Decoder</code> traits to encode and decode frames.</div></li><li><div class="item-name"><a class="struct" href="struct.FramedParts.html" title="struct actix_codec::FramedParts">Framed<wbr>Parts</a></div><div class="desc docblock-short"><code>FramedParts</code> contains an export of the data of a Framed transport.</div></li><li><div class="item-name"><a class="struct" href="struct.LinesCodec.html" title="struct actix_codec::LinesCodec">Lines<wbr>Codec</a></div><div class="desc docblock-short">Lines codec. Reads/writes line delimited strings.</div></li><li><div class="item-name"><a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a></div><div class="desc docblock-short">A wrapper around a byte buffer that is incrementally filled and initialized.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">Async<wbr>Read</a></div><div class="desc docblock-short">Reads bytes from a source.</div></li><li><div class="item-name"><a class="trait" href="trait.AsyncWrite.html" title="trait actix_codec::AsyncWrite">Async<wbr>Write</a></div><div class="desc docblock-short">Writes bytes asynchronously.</div></li><li><div class="item-name"><a class="trait" href="trait.Decoder.html" title="trait actix_codec::Decoder">Decoder</a></div><div class="desc docblock-short">Decoding of frames via buffers.</div></li><li><div class="item-name"><a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a></div><div class="desc docblock-short">Trait of helper objects to write out messages as bytes, for use with
|
||||||
|
<a href="crate::codec::FramedWrite"><code>FramedWrite</code></a>.</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.poll_read_buf.html" title="fn actix_codec::poll_read_buf">poll_<wbr>read_<wbr>buf</a></div><div class="desc docblock-short">Try to read data from an <code>AsyncRead</code> into an implementer of the <a href="bytes::Buf"><code>BufMut</code></a> trait.</div></li></ul></section></div></main></body></html>
|
11
actix_codec/lines/struct.LinesCodec.html
Normal file
11
actix_codec/lines/struct.LinesCodec.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_codec/struct.LinesCodec.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_codec/struct.LinesCodec.html">../../actix_codec/struct.LinesCodec.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_codec/struct.LinesCodec.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
1
actix_codec/sidebar-items.js
Normal file
1
actix_codec/sidebar-items.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
window.SIDEBAR_ITEMS = {"fn":["poll_read_buf"],"struct":["BytesCodec","Framed","FramedParts","LinesCodec","ReadBuf"],"trait":["AsyncRead","AsyncWrite","Decoder","Encoder"]};
|
29
actix_codec/struct.BytesCodec.html
Normal file
29
actix_codec/struct.BytesCodec.html
Normal file
File diff suppressed because one or more lines are too long
117
actix_codec/struct.Framed.html
Normal file
117
actix_codec/struct.Framed.html
Normal file
File diff suppressed because one or more lines are too long
43
actix_codec/struct.FramedParts.html
Normal file
43
actix_codec/struct.FramedParts.html
Normal file
File diff suppressed because one or more lines are too long
31
actix_codec/struct.LinesCodec.html
Normal file
31
actix_codec/struct.LinesCodec.html
Normal file
File diff suppressed because one or more lines are too long
83
actix_codec/struct.ReadBuf.html
Normal file
83
actix_codec/struct.ReadBuf.html
Normal file
File diff suppressed because one or more lines are too long
106
actix_codec/trait.AsyncRead.html
Normal file
106
actix_codec/trait.AsyncRead.html
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<!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="Reads bytes from a source."><title>AsyncRead in actix_codec - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_codec" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></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" title="show sidebar"></button><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_codec/index.html">actix_<wbr>codec</a><span class="version">0.5.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Async<wbr>Read</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.poll_read" title="poll_read">poll_read</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-AsyncRead-for-%26%5Bu8%5D" title="&[u8]">&[u8]</a></li><li><a href="#impl-AsyncRead-for-%26mut+T" title="&mut T">&mut T</a></li><li><a href="#impl-AsyncRead-for-Box%3CT%3E" title="Box<T>">Box<T></a></li><li><a href="#impl-AsyncRead-for-Cursor%3CT%3E" title="Cursor<T>">Cursor<T></a></li><li><a href="#impl-AsyncRead-for-Either%3CL,+R%3E" title="Either<L, R>">Either<L, R></a></li><li><a href="#impl-AsyncRead-for-InspectReader%3CR,+F%3E" title="InspectReader<R, F>">InspectReader<R, F></a></li><li><a href="#impl-AsyncRead-for-InspectWriter%3CW,+F%3E" title="InspectWriter<W, F>">InspectWriter<W, F></a></li><li><a href="#impl-AsyncRead-for-Pin%3CP%3E" title="Pin<P>">Pin<P></a></li><li><a href="#impl-AsyncRead-for-SinkWriter%3CS%3E" title="SinkWriter<S>">SinkWriter<S></a></li><li><a href="#impl-AsyncRead-for-StreamReader%3CS,+B%3E" title="StreamReader<S, B>">StreamReader<S, B></a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate actix_<wbr>codec</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">actix_codec</a></span><h1>Trait <span class="trait">AsyncRead</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub trait AsyncRead {
|
||||||
|
// Required method
|
||||||
|
fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
|
||||||
|
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><&mut Self>,
|
||||||
|
cx: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||||||
|
buf: &mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a><'_>,
|
||||||
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>>;
|
||||||
|
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Reads bytes from a source.</p>
|
||||||
|
<p>This trait is analogous to the <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read"><code>std::io::Read</code></a> trait, but integrates with
|
||||||
|
the asynchronous task system. In particular, the <a href="trait.AsyncRead.html#tymethod.poll_read" title="method actix_codec::AsyncRead::poll_read"><code>poll_read</code></a> method,
|
||||||
|
unlike <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#tymethod.read" title="method std::io::Read::read"><code>Read::read</code></a>, will automatically queue the current task for wakeup
|
||||||
|
and return if data is not yet available, rather than blocking the calling
|
||||||
|
thread.</p>
|
||||||
|
<p>Specifically, this means that the <code>poll_read</code> function will return one of
|
||||||
|
the following:</p>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<p><code>Poll::Ready(Ok(()))</code> means that data was immediately read and placed into
|
||||||
|
the output buffer. The amount of data read can be determined by the
|
||||||
|
increase in the length of the slice returned by <code>ReadBuf::filled</code>. If the
|
||||||
|
difference is 0, either EOF has been reached, or the output buffer had zero
|
||||||
|
capacity (i.e. <code>buf.remaining()</code> == 0).</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p><code>Poll::Pending</code> means that no data was read into the buffer
|
||||||
|
provided. The I/O object is not currently readable but may become readable
|
||||||
|
in the future. Most importantly, <strong>the current future’s task is scheduled
|
||||||
|
to get unparked when the object is readable</strong>. This means that like
|
||||||
|
<code>Future::poll</code> you’ll receive a notification when the I/O object is
|
||||||
|
readable again.</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p><code>Poll::Ready(Err(e))</code> for other errors are standard I/O errors coming from the
|
||||||
|
underlying object.</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p>This trait importantly means that the <code>read</code> method only works in the
|
||||||
|
context of a future’s task. The object may panic if used outside of a task.</p>
|
||||||
|
<p>Utilities for working with <code>AsyncRead</code> values are provided by
|
||||||
|
<a href="crate::io::AsyncReadExt"><code>AsyncReadExt</code></a>.</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.poll_read" class="method"><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
|
||||||
|
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><&mut Self>,
|
||||||
|
cx: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||||||
|
buf: &mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a><'_>,
|
||||||
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>></h4></section></summary><div class="docblock"><p>Attempts to read from the <code>AsyncRead</code> into <code>buf</code>.</p>
|
||||||
|
<p>On success, returns <code>Poll::Ready(Ok(()))</code> and places data in the
|
||||||
|
unfilled portion of <code>buf</code>. If no data was read (<code>buf.filled().len()</code> is
|
||||||
|
unchanged), it implies that EOF has been reached.</p>
|
||||||
|
<p>If no data is available for reading, the method returns <code>Poll::Pending</code>
|
||||||
|
and arranges for the current task (via <code>cx.waker()</code>) to receive a
|
||||||
|
notification when the object becomes readable or is closed.</p>
|
||||||
|
</div></details></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-AsyncRead-for-%26%5Bu8%5D" class="impl"><a href="#impl-AsyncRead-for-%26%5Bu8%5D" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]</h3></section></summary><div class="impl-items"><section id="method.poll_read" class="method trait-impl"><a href="#method.poll_read" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
|
||||||
|
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><&mut &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>,
|
||||||
|
_cx: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||||||
|
buf: &mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a><'_>,
|
||||||
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-Either%3CL,+R%3E" class="impl"><a href="#impl-AsyncRead-for-Either%3CL,+R%3E" class="anchor">§</a><h3 class="code-header">impl<L, R> <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for Either<L, R><div class="where">where
|
||||||
|
L: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a>,
|
||||||
|
R: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-1" class="method trait-impl"><a href="#method.poll_read-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
|
||||||
|
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><&mut Either<L, R>>,
|
||||||
|
cx: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||||||
|
buf: &mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a><'_>,
|
||||||
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-Pin%3CP%3E" class="impl"><a href="#impl-AsyncRead-for-Pin%3CP%3E" class="anchor">§</a><h3 class="code-header">impl<P> <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><P><div class="where">where
|
||||||
|
P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,
|
||||||
|
<P as <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a>: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-2" class="method trait-impl"><a href="#method.poll_read-2" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
|
||||||
|
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><&mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><P>>,
|
||||||
|
cx: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||||||
|
buf: &mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a><'_>,
|
||||||
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-InspectReader%3CR,+F%3E" class="impl"><a href="#impl-AsyncRead-for-InspectReader%3CR,+F%3E" class="anchor">§</a><h3 class="code-header">impl<R, F> <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for InspectReader<R, F><div class="where">where
|
||||||
|
R: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a>,
|
||||||
|
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]),</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-3" class="method trait-impl"><a href="#method.poll_read-3" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
|
||||||
|
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><&mut InspectReader<R, F>>,
|
||||||
|
cx: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||||||
|
buf: &mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a><'_>,
|
||||||
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-SinkWriter%3CS%3E" class="impl"><a href="#impl-AsyncRead-for-SinkWriter%3CS%3E" class="anchor">§</a><h3 class="code-header">impl<S> <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for SinkWriter<S><div class="where">where
|
||||||
|
S: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-4" class="method trait-impl"><a href="#method.poll_read-4" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
|
||||||
|
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><&mut SinkWriter<S>>,
|
||||||
|
cx: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||||||
|
buf: &mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a><'_>,
|
||||||
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-StreamReader%3CS,+B%3E" class="impl"><a href="#impl-AsyncRead-for-StreamReader%3CS,+B%3E" class="anchor">§</a><h3 class="code-header">impl<S, B, E> <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for StreamReader<S, B><div class="where">where
|
||||||
|
S: Stream<Item = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><B, E>>,
|
||||||
|
B: Buf,
|
||||||
|
E: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-5" class="method trait-impl"><a href="#method.poll_read-5" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
|
||||||
|
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><&mut StreamReader<S, B>>,
|
||||||
|
cx: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||||||
|
buf: &mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a><'_>,
|
||||||
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-%26mut+T" class="impl"><a href="#impl-AsyncRead-for-%26mut+T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut T</a><div class="where">where
|
||||||
|
T: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-6" class="method trait-impl"><a href="#method.poll_read-6" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
|
||||||
|
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><&mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut T</a>>,
|
||||||
|
cx: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||||||
|
buf: &mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a><'_>,
|
||||||
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-Box%3CT%3E" class="impl"><a href="#impl-AsyncRead-for-Box%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><T><div class="where">where
|
||||||
|
T: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-7" class="method trait-impl"><a href="#method.poll_read-7" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
|
||||||
|
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><&mut <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><T>>,
|
||||||
|
cx: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||||||
|
buf: &mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a><'_>,
|
||||||
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-Cursor%3CT%3E" class="impl"><a href="#impl-AsyncRead-for-Cursor%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/cursor/struct.Cursor.html" title="struct std::io::cursor::Cursor">Cursor</a><T><div class="where">where
|
||||||
|
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-8" class="method trait-impl"><a href="#method.poll_read-8" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
|
||||||
|
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><&mut <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/cursor/struct.Cursor.html" title="struct std::io::cursor::Cursor">Cursor</a><T>>,
|
||||||
|
_cx: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||||||
|
buf: &mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a><'_>,
|
||||||
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-InspectWriter%3CW,+F%3E" class="impl"><a href="#impl-AsyncRead-for-InspectWriter%3CW,+F%3E" class="anchor">§</a><h3 class="code-header">impl<W, F> <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for InspectWriter<W, F><div class="where">where
|
||||||
|
W: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-9" class="method trait-impl"><a href="#method.poll_read-9" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
|
||||||
|
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><&mut InspectWriter<W, F>>,
|
||||||
|
cx: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||||||
|
buf: &mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a><'_>,
|
||||||
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-AsyncRead-for-OwnedReadHalf" class="impl"><a href="#impl-AsyncRead-for-OwnedReadHalf" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for OwnedReadHalf</h3></section><section id="impl-AsyncRead-for-OwnedReadHalf-1" class="impl"><a href="#impl-AsyncRead-for-OwnedReadHalf-1" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for OwnedReadHalf</h3></section><section id="impl-AsyncRead-for-ReadHalf%3C'_%3E" class="impl"><a href="#impl-AsyncRead-for-ReadHalf%3C'_%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for ReadHalf<'_></h3></section><section id="impl-AsyncRead-for-ReadHalf%3C'_%3E-1" class="impl"><a href="#impl-AsyncRead-for-ReadHalf%3C'_%3E-1" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for ReadHalf<'_></h3></section><section id="impl-AsyncRead-for-Receiver" class="impl"><a href="#impl-AsyncRead-for-Receiver" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for Receiver</h3></section><section id="impl-AsyncRead-for-TcpStream" class="impl"><a href="#impl-AsyncRead-for-TcpStream" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for TcpStream</h3></section><section id="impl-AsyncRead-for-UnixStream" class="impl"><a href="#impl-AsyncRead-for-UnixStream" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for UnixStream</h3></section></div><script src="../trait.impl/tokio/io/async_read/trait.AsyncRead.js" data-ignore-extern-crates="alloc,core,tokio,std,tokio_util" async></script></section></div></main></body></html>
|
334
actix_codec/trait.AsyncWrite.html
Normal file
334
actix_codec/trait.AsyncWrite.html
Normal file
File diff suppressed because one or more lines are too long
130
actix_codec/trait.Decoder.html
Normal file
130
actix_codec/trait.Decoder.html
Normal file
File diff suppressed because one or more lines are too long
21
actix_codec/trait.Encoder.html
Normal file
21
actix_codec/trait.Encoder.html
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<!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="Trait of helper objects to write out messages as bytes, for use with `FramedWrite`."><title>Encoder in actix_codec - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_codec" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></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" title="show sidebar"></button><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_codec/index.html">actix_<wbr>codec</a><span class="version">0.5.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Encoder</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.encode" title="encode">encode</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate actix_<wbr>codec</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">actix_codec</a></span><h1>Trait <span class="trait">Encoder</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub trait Encoder<Item> {
|
||||||
|
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>;
|
||||||
|
|
||||||
|
// Required method
|
||||||
|
fn <a href="#tymethod.encode" class="fn">encode</a>(
|
||||||
|
&mut self,
|
||||||
|
item: Item,
|
||||||
|
dst: &mut BytesMut,
|
||||||
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.Encoder.html#associatedtype.Error" title="type actix_codec::Encoder::Error">Error</a>>;
|
||||||
|
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait of helper objects to write out messages as bytes, for use with
|
||||||
|
<a href="crate::codec::FramedWrite"><code>FramedWrite</code></a>.</p>
|
||||||
|
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><div class="docblock"><p>The type of encoding errors.</p>
|
||||||
|
<p><a href="crate::codec::FramedWrite"><code>FramedWrite</code></a> requires <code>Encoder</code>s errors to implement <code>From<io::Error></code>
|
||||||
|
in the interest of letting it return <code>Error</code>s directly.</p>
|
||||||
|
</div></details></div><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.encode" class="method"><h4 class="code-header">fn <a href="#tymethod.encode" class="fn">encode</a>(&mut self, item: Item, dst: &mut BytesMut) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.Encoder.html#associatedtype.Error" title="type actix_codec::Encoder::Error">Error</a>></h4></section></summary><div class="docblock"><p>Encodes a frame into the buffer provided.</p>
|
||||||
|
<p>This method will encode <code>item</code> into the byte buffer provided by <code>dst</code>.
|
||||||
|
The <code>dst</code> provided is an internal buffer of the <a href="crate::codec::FramedWrite"><code>FramedWrite</code></a> instance and
|
||||||
|
will be written out when possible.</p>
|
||||||
|
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-Encoder%3CBytes%3E-for-BytesCodec" class="impl"><a class="src rightside" href="../src/actix_codec/bcodec.rs.html#11-19">source</a><a href="#impl-Encoder%3CBytes%3E-for-BytesCodec" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a><Bytes> for actix_codec::<a class="struct" href="struct.BytesCodec.html" title="struct actix_codec::BytesCodec">BytesCodec</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/actix_codec/bcodec.rs.html#12">source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Encoder%3CBytes%3E-for-BytesCodec-1" class="impl"><a href="#impl-Encoder%3CBytes%3E-for-BytesCodec-1" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a><Bytes> for BytesCodec</h3></section></summary><div class="impl-items"><section id="associatedtype.Error-2" class="associatedtype trait-impl"><a href="#associatedtype.Error-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Encoder%3CBytes%3E-for-LengthDelimitedCodec" class="impl"><a href="#impl-Encoder%3CBytes%3E-for-LengthDelimitedCodec" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a><Bytes> for LengthDelimitedCodec</h3></section></summary><div class="impl-items"><section id="associatedtype.Error-3" class="associatedtype trait-impl"><a href="#associatedtype.Error-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Encoder%3CBytesMut%3E-for-BytesCodec" class="impl"><a href="#impl-Encoder%3CBytesMut%3E-for-BytesCodec" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a><BytesMut> for BytesCodec</h3></section></summary><div class="impl-items"><section id="associatedtype.Error-4" class="associatedtype trait-impl"><a href="#associatedtype.Error-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Encoder%3CT%3E-for-AnyDelimiterCodec" class="impl"><a href="#impl-Encoder%3CT%3E-for-AnyDelimiterCodec" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a><T> for AnyDelimiterCodec<div class="where">where
|
||||||
|
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-5" class="associatedtype trait-impl"><a href="#associatedtype.Error-5" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = AnyDelimiterCodecError</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Encoder%3CT%3E-for-LinesCodec" class="impl"><a href="#impl-Encoder%3CT%3E-for-LinesCodec" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a><T> for LinesCodec<div class="where">where
|
||||||
|
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-6" class="associatedtype trait-impl"><a href="#associatedtype.Error-6" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = LinesCodecError</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Encoder%3CT%3E-for-LinesCodec-1" class="impl"><a class="src rightside" href="../src/actix_codec/lines.rs.html#16-27">source</a><a href="#impl-Encoder%3CT%3E-for-LinesCodec-1" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>>> <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a><T> for actix_codec::<a class="struct" href="struct.LinesCodec.html" title="struct actix_codec::LinesCodec">LinesCodec</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-7" class="associatedtype trait-impl"><a class="src rightside" href="../src/actix_codec/lines.rs.html#17">source</a><a href="#associatedtype.Error-7" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a></h4></section></div></details></div><script src="../trait.impl/tokio_util/codec/encoder/trait.Encoder.js" data-ignore-extern-crates="tokio_util" async></script></section></div></main></body></html>
|
1
actix_macros/all.html
Normal file
1
actix_macros/all.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!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="List of all items in this crate"><title>List of all items in this crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_macros" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod sys"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_macros/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_macros/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_macros/index.html">actix_<wbr>macros</a><span class="version">0.2.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h3><a href="#attributes">Crate Items</a></h3><ul class="block"><li><a href="#attributes" title="Attribute Macros">Attribute Macros</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><h1>List of all items</h1><h3 id="attributes">Attribute Macros</h3><ul class="all-items"><li><a href="attr.main.html">main</a></li><li><a href="attr.test.html">test</a></li></ul></section></div></main></body></html>
|
7
actix_macros/attr.main.html
Normal file
7
actix_macros/attr.main.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<!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="Marks async entry-point function to be executed by Actix system."><title>main in actix_macros - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_macros" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc attr"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_macros/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_macros/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_macros/index.html">actix_<wbr>macros</a><span class="version">0.2.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">main</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate actix_<wbr>macros</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">actix_macros</a></span><h1>Attribute Macro <span class="attr">main</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/actix_macros/lib.rs.html#32-108">source</a> </span></div><pre class="rust item-decl"><code>#[main]</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Marks async entry-point function to be executed by Actix system.</p>
|
||||||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#[actix_rt::main]
|
||||||
|
</span><span class="kw">async fn </span>main() {
|
||||||
|
<span class="macro">println!</span>(<span class="string">"Hello world"</span>);
|
||||||
|
}</code></pre></div>
|
||||||
|
</div></details></section></div></main></body></html>
|
7
actix_macros/attr.test.html
Normal file
7
actix_macros/attr.test.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<!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="Marks async test function to be executed in an Actix system."><title>test in actix_macros - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_macros" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc attr"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_macros/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_macros/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_macros/index.html">actix_<wbr>macros</a><span class="version">0.2.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">test</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate actix_<wbr>macros</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">actix_macros</a></span><h1>Attribute Macro <span class="attr">test</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/actix_macros/lib.rs.html#120-209">source</a> </span></div><pre class="rust item-decl"><code>#[test]</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Marks async test function to be executed in an Actix system.</p>
|
||||||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#[actix_rt::test]
|
||||||
|
</span><span class="kw">async fn </span>my_test() {
|
||||||
|
<span class="macro">assert!</span>(<span class="bool-val">true</span>);
|
||||||
|
}</code></pre></div>
|
||||||
|
</div></details></section></div></main></body></html>
|
7
actix_macros/index.html
Normal file
7
actix_macros/index.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<!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="Macros for Actix system and runtime."><title>actix_macros - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_macros" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod crate"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_macros/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_macros/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_macros/index.html">actix_<wbr>macros</a><span class="version">0.2.4</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#entry-point" title="Entry-point">Entry-point</a></li><li><a href="#tests" title="Tests">Tests</a></li></ul><h3><a href="#attributes">Crate Items</a></h3><ul class="block"><li><a href="#attributes" title="Attribute Macros">Attribute Macros</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>actix_macros</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/actix_macros/lib.rs.html#1-221">source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Macros for Actix system and runtime.</p>
|
||||||
|
<p>The <a href="https://docs.rs/actix-rt"><code>actix-rt</code></a> crate must be available for macro output to compile.</p>
|
||||||
|
<h2 id="entry-point"><a class="doc-anchor" href="#entry-point">§</a>Entry-point</h2>
|
||||||
|
<p>See docs for the <a href="attr.main.html" title="attr actix_macros::main"><code>#[main]</code></a> macro.</p>
|
||||||
|
<h2 id="tests"><a class="doc-anchor" href="#tests">§</a>Tests</h2>
|
||||||
|
<p>See docs for the <a href="attr.test.html" title="attr actix_macros::test"><code>#[test]</code></a> macro.</p>
|
||||||
|
</div></details><h2 id="attributes" class="section-header">Attribute Macros<a href="#attributes" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="attr" href="attr.main.html" title="attr actix_macros::main">main</a></div><div class="desc docblock-short">Marks async entry-point function to be executed by Actix system.</div></li><li><div class="item-name"><a class="attr" href="attr.test.html" title="attr actix_macros::test">test</a></div><div class="desc docblock-short">Marks async test function to be executed in an Actix system.</div></li></ul></section></div></main></body></html>
|
1
actix_macros/sidebar-items.js
Normal file
1
actix_macros/sidebar-items.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
window.SIDEBAR_ITEMS = {"attr":["main","test"]};
|
1
actix_rt/all.html
Normal file
1
actix_rt/all.html
Normal file
File diff suppressed because one or more lines are too long
11
actix_rt/arbiter/struct.Arbiter.html
Normal file
11
actix_rt/arbiter/struct.Arbiter.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_rt/struct.Arbiter.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_rt/struct.Arbiter.html">../../actix_rt/struct.Arbiter.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_rt/struct.Arbiter.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
11
actix_rt/arbiter/struct.ArbiterHandle.html
Normal file
11
actix_rt/arbiter/struct.ArbiterHandle.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_rt/struct.ArbiterHandle.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_rt/struct.ArbiterHandle.html">../../actix_rt/struct.ArbiterHandle.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_rt/struct.ArbiterHandle.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
7
actix_rt/attr.main.html
Normal file
7
actix_rt/attr.main.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<!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="Marks async entry-point function to be executed by Actix system."><title>main in actix_rt - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc attr"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">main</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate actix_<wbr>rt</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">actix_rt</a></span><h1>Attribute Macro <span class="attr">main</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>#[main]</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Marks async entry-point function to be executed by Actix system.</p>
|
||||||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#[actix_rt::main]
|
||||||
|
</span><span class="kw">async fn </span>main() {
|
||||||
|
<span class="macro">println!</span>(<span class="string">"Hello world"</span>);
|
||||||
|
}</code></pre></div>
|
||||||
|
</div></details></section></div></main></body></html>
|
7
actix_rt/attr.test.html
Normal file
7
actix_rt/attr.test.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<!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="Marks async test function to be executed in an Actix system."><title>test in actix_rt - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc attr"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">test</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate actix_<wbr>rt</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">actix_rt</a></span><h1>Attribute Macro <span class="attr">test</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>#[test]</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Marks async test function to be executed in an Actix system.</p>
|
||||||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#[actix_rt::test]
|
||||||
|
</span><span class="kw">async fn </span>my_test() {
|
||||||
|
<span class="macro">assert!</span>(<span class="bool-val">true</span>);
|
||||||
|
}</code></pre></div>
|
||||||
|
</div></details></section></div></main></body></html>
|
24
actix_rt/fn.spawn.html
Normal file
24
actix_rt/fn.spawn.html
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<!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="Spawns a future on the current thread as a new task."><title>spawn in actix_rt - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">spawn</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate actix_<wbr>rt</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">actix_rt</a></span><h1>Function <span class="fn">spawn</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/actix_rt/lib.rs.html#203-209">source</a> </span></div><pre class="rust item-decl"><code>pub fn spawn<Fut>(f: Fut) -> <a class="struct" href="task/struct.JoinHandle.html" title="struct actix_rt::task::JoinHandle">JoinHandle</a><Fut::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>> <a href="#" class="tooltip" data-notable-ty="JoinHandle<Fut::Output>">ⓘ</a><div class="where">where
|
||||||
|
Fut: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a> + 'static,
|
||||||
|
Fut::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>: 'static,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Spawns a future on the current thread as a new task.</p>
|
||||||
|
<p>If not immediately awaited, the task can be cancelled using <a href="task/struct.JoinHandle.html#method.abort" title="method actix_rt::task::JoinHandle::abort"><code>JoinHandle::abort</code></a>.</p>
|
||||||
|
<p>The provided future is spawned as a new task; therefore, panics are caught.</p>
|
||||||
|
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
|
||||||
|
<p>Panics if Actix system is not running.</p>
|
||||||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// task resolves successfully
|
||||||
|
</span><span class="macro">assert_eq!</span>(actix_rt::spawn(<span class="kw">async </span>{ <span class="number">1 </span>}).<span class="kw">await</span>.unwrap(), <span class="number">1</span>);
|
||||||
|
|
||||||
|
<span class="comment">// task panics
|
||||||
|
</span><span class="macro">assert!</span>(actix_rt::spawn(<span class="kw">async </span>{
|
||||||
|
<span class="macro">panic!</span>(<span class="string">"panic is caught at task boundary"</span>);
|
||||||
|
})
|
||||||
|
.<span class="kw">await
|
||||||
|
</span>.unwrap_err()
|
||||||
|
.is_panic());
|
||||||
|
|
||||||
|
<span class="comment">// task is cancelled before completion
|
||||||
|
</span><span class="kw">let </span>handle = actix_rt::spawn(actix_rt::time::sleep(Duration::from_secs(<span class="number">100</span>)));
|
||||||
|
handle.abort();
|
||||||
|
<span class="macro">assert!</span>(handle.<span class="kw">await</span>.unwrap_err().is_cancelled());</code></pre></div>
|
||||||
|
</div></details><script type="text/json" id="notable-traits-data">{"JoinHandle<Fut::Output>":"<h3>Notable traits for <code><a class=\"struct\" href=\"task/struct.JoinHandle.html\" title=\"struct actix_rt::task::JoinHandle\">JoinHandle</a><T></code></h3><pre><code><div class=\"where\">impl<T> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"task/struct.JoinHandle.html\" title=\"struct actix_rt::task::JoinHandle\">JoinHandle</a><T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <a class=\"enum\" href=\"https://doc.rust-lang.org/nightly/core/result/enum.Result.html\" title=\"enum core::result::Result\">Result</a><T, <a class=\"struct\" href=\"task/struct.JoinError.html\" title=\"struct actix_rt::task::JoinError\">JoinError</a>>;</div>"}</script></section></div></main></body></html>
|
35
actix_rt/index.html
Normal file
35
actix_rt/index.html
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<!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="Tokio-based single-threaded async runtime for the Actix ecosystem."><title>actix_rt - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod crate"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li><li><a href="#io-uring-support" title="`io-uring` Support"><code>io-uring</code> Support</a></li></ul><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#macros" title="Macros">Macros</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#attributes" title="Attribute Macros">Attribute Macros</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>actix_rt</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/actix_rt/lib.rs.html#1-209">source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Tokio-based single-threaded async runtime for the Actix ecosystem.</p>
|
||||||
|
<p>In most parts of the the Actix ecosystem, it has been chosen to use !Send futures. For this
|
||||||
|
reason, a single-threaded runtime is appropriate since it is guaranteed that futures will not
|
||||||
|
be moved between threads. This can result in small performance improvements over cases where
|
||||||
|
atomics would otherwise be needed.</p>
|
||||||
|
<p>To achieve similar performance to multi-threaded, work-stealing runtimes, applications
|
||||||
|
using <code>actix-rt</code> will create multiple, mostly disconnected, single-threaded runtimes.
|
||||||
|
This approach has good performance characteristics for workloads where the majority of tasks
|
||||||
|
have similar runtime expense.</p>
|
||||||
|
<p>The disadvantage is that idle threads will not steal work from very busy, stuck or otherwise
|
||||||
|
backlogged threads. Tasks that are disproportionately expensive should be offloaded to the
|
||||||
|
blocking task thread-pool using <a href="task/fn.spawn_blocking.html" title="fn actix_rt::task::spawn_blocking"><code>task::spawn_blocking</code></a>.</p>
|
||||||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::sync::mpsc;
|
||||||
|
<span class="kw">use </span>actix_rt::{Arbiter, System};
|
||||||
|
|
||||||
|
<span class="kw">let _ </span>= System::new();
|
||||||
|
|
||||||
|
<span class="kw">let </span>(tx, rx) = mpsc::channel::<u32>();
|
||||||
|
|
||||||
|
<span class="kw">let </span>arbiter = Arbiter::new();
|
||||||
|
arbiter.spawn_fn(<span class="kw">move </span>|| tx.send(<span class="number">42</span>).unwrap());
|
||||||
|
|
||||||
|
<span class="kw">let </span>num = rx.recv().unwrap();
|
||||||
|
<span class="macro">assert_eq!</span>(num, <span class="number">42</span>);
|
||||||
|
|
||||||
|
arbiter.stop();
|
||||||
|
arbiter.join().unwrap();</code></pre></div>
|
||||||
|
<h2 id="io-uring-support"><a class="doc-anchor" href="#io-uring-support">§</a><code>io-uring</code> Support</h2>
|
||||||
|
<p>There is experimental support for using io-uring with this crate by enabling the
|
||||||
|
<code>io-uring</code> feature. For now, it is semver exempt.</p>
|
||||||
|
<p>Note that there are currently some unimplemented parts of using <code>actix-rt</code> with <code>io-uring</code>.
|
||||||
|
In particular, when running a <code>System</code>, only <code>System::block_on</code> is supported.</p>
|
||||||
|
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="net/index.html" title="mod actix_rt::net">net</a></div><div class="desc docblock-short">TCP/UDP/Unix bindings (mostly Tokio re-exports).</div></li><li><div class="item-name"><a class="mod" href="signal/index.html" title="mod actix_rt::signal">signal</a></div><div class="desc docblock-short">Asynchronous signal handling (Tokio re-exports).</div></li><li><div class="item-name"><a class="mod" href="task/index.html" title="mod actix_rt::task">task</a></div><div class="desc docblock-short">Task management (Tokio re-exports).</div></li><li><div class="item-name"><a class="mod" href="time/index.html" title="mod actix_rt::time">time</a></div><div class="desc docblock-short">Utilities for tracking time (Tokio re-exports).</div></li></ul><h2 id="macros" class="section-header">Macros<a href="#macros" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="macro" href="macro.pin.html" title="macro actix_rt::pin">pin</a></div><div class="desc docblock-short">Pins a value on the stack.</div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Arbiter.html" title="struct actix_rt::Arbiter">Arbiter</a></div><div class="desc docblock-short">An Arbiter represents a thread that provides an asynchronous execution environment for futures
|
||||||
|
and functions.</div></li><li><div class="item-name"><a class="struct" href="struct.ArbiterHandle.html" title="struct actix_rt::ArbiterHandle">Arbiter<wbr>Handle</a></div><div class="desc docblock-short">A handle for sending spawn and stop messages to an <a href="struct.Arbiter.html" title="struct actix_rt::Arbiter">Arbiter</a>.</div></li><li><div class="item-name"><a class="struct" href="struct.Runtime.html" title="struct actix_rt::Runtime">Runtime</a></div><div class="desc docblock-short">A Tokio-based runtime proxy.</div></li><li><div class="item-name"><a class="struct" href="struct.System.html" title="struct actix_rt::System">System</a></div><div class="desc docblock-short">A manager for a per-thread distributed async runtime.</div></li><li><div class="item-name"><a class="struct" href="struct.SystemRunner.html" title="struct actix_rt::SystemRunner">System<wbr>Runner</a></div><div class="desc docblock-short">Runner that keeps a <a href="struct.System.html" title="struct actix_rt::System">System</a>’s event loop alive until stop message is received.</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.spawn.html" title="fn actix_rt::spawn">spawn</a></div><div class="desc docblock-short">Spawns a future on the current thread as a new task.</div></li></ul><h2 id="attributes" class="section-header">Attribute Macros<a href="#attributes" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="attr" href="attr.main.html" title="attr actix_rt::main">main</a></div><div class="desc docblock-short">Marks async entry-point function to be executed by Actix system.</div></li><li><div class="item-name"><a class="attr" href="attr.test.html" title="attr actix_rt::test">test</a></div><div class="desc docblock-short">Marks async test function to be executed in an Actix system.</div></li></ul></section></div></main></body></html>
|
11
actix_rt/macro.pin!.html
Normal file
11
actix_rt/macro.pin!.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=macro.pin.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="macro.pin.html">macro.pin.html</a>...</p>
|
||||||
|
<script>location.replace("macro.pin.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
104
actix_rt/macro.pin.html
Normal file
104
actix_rt/macro.pin.html
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
<!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="Pins a value on the stack."><title>pin in actix_rt - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc macro"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">pin</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#usage" title="Usage">Usage</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate actix_<wbr>rt</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">actix_rt</a></span><h1>Macro <span class="macro">pin</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><span class="macro">macro_rules!</span> pin {
|
||||||
|
($(<span class="macro-nonterminal">$x</span>:ident),<span class="kw-2">*</span>) => { ... };
|
||||||
|
($(
|
||||||
|
<span class="kw">let </span><span class="macro-nonterminal">$x</span>:ident = <span class="macro-nonterminal">$init</span>:expr;
|
||||||
|
)<span class="kw-2">*</span>) => { ... };
|
||||||
|
}</pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Pins a value on the stack.</p>
|
||||||
|
<p>Calls to <code>async fn</code> return anonymous <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future"><code>Future</code></a> values that are <code>!Unpin</code>.
|
||||||
|
These values must be pinned before they can be polled. Calling <code>.await</code> will
|
||||||
|
handle this, but consumes the future. If it is required to call <code>.await</code> on
|
||||||
|
a <code>&mut _</code> reference, the caller is responsible for pinning the future.</p>
|
||||||
|
<p>Pinning may be done by allocating with <a href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html#method.pin" title="associated function alloc::boxed::Box::pin"><code>Box::pin</code></a> or by using the stack
|
||||||
|
with the <code>pin!</code> macro.</p>
|
||||||
|
<p>The following will <strong>fail to compile</strong>:</p>
|
||||||
|
|
||||||
|
<div class="example-wrap compile_fail"><a href="#" class="tooltip" title="This example deliberately fails to compile">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">async fn </span>my_async_fn() {
|
||||||
|
<span class="comment">// async logic here
|
||||||
|
</span>}
|
||||||
|
|
||||||
|
<span class="attr">#[tokio::main]
|
||||||
|
</span><span class="kw">async fn </span>main() {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>future = my_async_fn();
|
||||||
|
(<span class="kw-2">&mut </span>future).<span class="kw">await</span>;
|
||||||
|
}</code></pre></div>
|
||||||
|
<p>To make this work requires pinning:</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::pin;
|
||||||
|
|
||||||
|
<span class="kw">async fn </span>my_async_fn() {
|
||||||
|
<span class="comment">// async logic here
|
||||||
|
</span>}
|
||||||
|
|
||||||
|
<span class="attr">#[tokio::main]
|
||||||
|
</span><span class="kw">async fn </span>main() {
|
||||||
|
<span class="kw">let </span>future = my_async_fn();
|
||||||
|
<span class="macro">pin!</span>(future);
|
||||||
|
|
||||||
|
(<span class="kw-2">&mut </span>future).<span class="kw">await</span>;
|
||||||
|
}</code></pre></div>
|
||||||
|
<p>Pinning is useful when using <code>select!</code> and stream operators that require <code>T: Stream + Unpin</code>.</p>
|
||||||
|
<h2 id="usage"><a class="doc-anchor" href="#usage">§</a>Usage</h2>
|
||||||
|
<p>The <code>pin!</code> macro takes <strong>identifiers</strong> as arguments. It does <strong>not</strong> work
|
||||||
|
with expressions.</p>
|
||||||
|
<p>The following does not compile as an expression is passed to <code>pin!</code>.</p>
|
||||||
|
|
||||||
|
<div class="example-wrap compile_fail"><a href="#" class="tooltip" title="This example deliberately fails to compile">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">async fn </span>my_async_fn() {
|
||||||
|
<span class="comment">// async logic here
|
||||||
|
</span>}
|
||||||
|
|
||||||
|
<span class="attr">#[tokio::main]
|
||||||
|
</span><span class="kw">async fn </span>main() {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>future = <span class="macro">pin!</span>(my_async_fn());
|
||||||
|
(<span class="kw-2">&mut </span>future).<span class="kw">await</span>;
|
||||||
|
}</code></pre></div>
|
||||||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||||
|
<p>Using with select:</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::{pin, select};
|
||||||
|
<span class="kw">use </span>tokio_stream::{<span class="self">self </span><span class="kw">as </span>stream, StreamExt};
|
||||||
|
|
||||||
|
<span class="kw">async fn </span>my_async_fn() {
|
||||||
|
<span class="comment">// async logic here
|
||||||
|
</span>}
|
||||||
|
|
||||||
|
<span class="attr">#[tokio::main]
|
||||||
|
</span><span class="kw">async fn </span>main() {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>stream = stream::iter(<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);
|
||||||
|
|
||||||
|
<span class="kw">let </span>future = my_async_fn();
|
||||||
|
<span class="macro">pin!</span>(future);
|
||||||
|
|
||||||
|
<span class="kw">loop </span>{
|
||||||
|
<span class="macro">select!</span> {
|
||||||
|
<span class="kw">_ </span>= <span class="kw-2">&mut </span>future => {
|
||||||
|
<span class="comment">// Stop looping `future` will be polled after completion
|
||||||
|
</span><span class="kw">break</span>;
|
||||||
|
}
|
||||||
|
<span class="prelude-val">Some</span>(val) = stream.next() => {
|
||||||
|
<span class="macro">println!</span>(<span class="string">"got value = {}"</span>, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}</code></pre></div>
|
||||||
|
<p>Because assigning to a variable followed by pinning is common, there is also
|
||||||
|
a variant of the macro that supports doing both in one go.</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::{pin, select};
|
||||||
|
|
||||||
|
<span class="kw">async fn </span>my_async_fn() {
|
||||||
|
<span class="comment">// async logic here
|
||||||
|
</span>}
|
||||||
|
|
||||||
|
<span class="attr">#[tokio::main]
|
||||||
|
</span><span class="kw">async fn </span>main() {
|
||||||
|
<span class="macro">pin!</span> {
|
||||||
|
<span class="kw">let </span>future1 = my_async_fn();
|
||||||
|
<span class="kw">let </span>future2 = my_async_fn();
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="macro">select!</span> {
|
||||||
|
<span class="kw">_ </span>= <span class="kw-2">&mut </span>future1 => {}
|
||||||
|
<span class="kw">_ </span>= <span class="kw-2">&mut </span>future2 => {}
|
||||||
|
}
|
||||||
|
}</code></pre></div>
|
||||||
|
</div></details></section></div></main></body></html>
|
3
actix_rt/net/index.html
Normal file
3
actix_rt/net/index.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<!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="TCP/UDP/Unix bindings (mostly Tokio re-exports)."><title>actix_rt::net - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module net</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate actix_<wbr>rt</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_rt</a></span><h1>Module <span>net</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/actix_rt/lib.rs.html#86">source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>TCP/UDP/Unix bindings (mostly Tokio re-exports).</p>
|
||||||
|
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Ready.html" title="struct actix_rt::net::Ready">Ready</a></div><div class="desc docblock-short">Describes the readiness state of an I/O resources.</div></li><li><div class="item-name"><a class="struct" href="struct.TcpListener.html" title="struct actix_rt::net::TcpListener">TcpListener</a></div><div class="desc docblock-short">A TCP socket server, listening for connections.</div></li><li><div class="item-name"><a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></div><div class="desc docblock-short">A TCP socket that has not yet been converted to a <code>TcpStream</code> or
|
||||||
|
<code>TcpListener</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.TcpStream.html" title="struct actix_rt::net::TcpStream">TcpStream</a></div><div class="desc docblock-short">A TCP stream between a local and a remote socket.</div></li><li><div class="item-name"><a class="struct" href="struct.UdpSocket.html" title="struct actix_rt::net::UdpSocket">UdpSocket</a></div><div class="desc docblock-short">A UDP socket.</div></li><li><div class="item-name"><a class="struct" href="struct.UnixDatagram.html" title="struct actix_rt::net::UnixDatagram">Unix<wbr>Datagram</a></div><div class="desc docblock-short">An I/O object representing a Unix datagram socket.</div></li><li><div class="item-name"><a class="struct" href="struct.UnixListener.html" title="struct actix_rt::net::UnixListener">Unix<wbr>Listener</a></div><div class="desc docblock-short">A Unix socket which can accept connections from other Unix sockets.</div></li><li><div class="item-name"><a class="struct" href="struct.UnixStream.html" title="struct actix_rt::net::UnixStream">Unix<wbr>Stream</a></div><div class="desc docblock-short">A structure representing a connected Unix socket.</div></li></ul></section></div></main></body></html>
|
1
actix_rt/net/sidebar-items.js
Normal file
1
actix_rt/net/sidebar-items.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
window.SIDEBAR_ITEMS = {"struct":["Ready","TcpListener","TcpSocket","TcpStream","UdpSocket","UnixDatagram","UnixListener","UnixStream"]};
|
80
actix_rt/net/struct.Ready.html
Normal file
80
actix_rt/net/struct.Ready.html
Normal file
File diff suppressed because one or more lines are too long
198
actix_rt/net/struct.TcpListener.html
Normal file
198
actix_rt/net/struct.TcpListener.html
Normal file
File diff suppressed because one or more lines are too long
394
actix_rt/net/struct.TcpSocket.html
Normal file
394
actix_rt/net/struct.TcpSocket.html
Normal file
File diff suppressed because one or more lines are too long
718
actix_rt/net/struct.TcpStream.html
Normal file
718
actix_rt/net/struct.TcpStream.html
Normal file
File diff suppressed because one or more lines are too long
1030
actix_rt/net/struct.UdpSocket.html
Normal file
1030
actix_rt/net/struct.UdpSocket.html
Normal file
File diff suppressed because one or more lines are too long
868
actix_rt/net/struct.UnixDatagram.html
Normal file
868
actix_rt/net/struct.UnixDatagram.html
Normal file
File diff suppressed because one or more lines are too long
90
actix_rt/net/struct.UnixListener.html
Normal file
90
actix_rt/net/struct.UnixListener.html
Normal file
File diff suppressed because one or more lines are too long
575
actix_rt/net/struct.UnixStream.html
Normal file
575
actix_rt/net/struct.UnixStream.html
Normal file
File diff suppressed because one or more lines are too long
11
actix_rt/runtime/struct.Runtime.html
Normal file
11
actix_rt/runtime/struct.Runtime.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_rt/struct.Runtime.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_rt/struct.Runtime.html">../../actix_rt/struct.Runtime.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_rt/struct.Runtime.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
1
actix_rt/sidebar-items.js
Normal file
1
actix_rt/sidebar-items.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
window.SIDEBAR_ITEMS = {"attr":["main","test"],"fn":["spawn"],"macro":["pin"],"mod":["net","signal","task","time"],"struct":["Arbiter","ArbiterHandle","Runtime","System","SystemRunner"]};
|
39
actix_rt/signal/fn.ctrl_c.html
Normal file
39
actix_rt/signal/fn.ctrl_c.html
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<!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="Completes when a “ctrl-c” notification is sent to the process."><title>ctrl_c in actix_rt::signal - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">ctrl_c</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#caveats" title="Caveats">Caveats</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In actix_<wbr>rt::<wbr>signal</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_rt</a>::<wbr><a href="index.html">signal</a></span><h1>Function <span class="fn">ctrl_c</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub async fn ctrl_c() -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Completes when a “ctrl-c” notification is sent to the process.</p>
|
||||||
|
<p>While signals are handled very differently between Unix and Windows, both
|
||||||
|
platforms support receiving a signal on “ctrl-c”. This function provides a
|
||||||
|
portable API for receiving this notification.</p>
|
||||||
|
<p>Once the returned future is polled, a listener is registered. The future
|
||||||
|
will complete on the first received <code>ctrl-c</code> <strong>after</strong> the initial call to
|
||||||
|
either <code>Future::poll</code> or <code>.await</code>.</p>
|
||||||
|
<h2 id="caveats"><a class="doc-anchor" href="#caveats">§</a>Caveats</h2>
|
||||||
|
<p>On Unix platforms, the first time that a <code>Signal</code> instance is registered for a
|
||||||
|
particular signal kind, an OS signal-handler is installed which replaces the
|
||||||
|
default platform behavior when that signal is received, <strong>for the duration of
|
||||||
|
the entire process</strong>.</p>
|
||||||
|
<p>For example, Unix systems will terminate a process by default when it
|
||||||
|
receives a signal generated by <code>"CTRL+C"</code> on the terminal. But, when a
|
||||||
|
<code>ctrl_c</code> stream is created to listen for this signal, the time it arrives,
|
||||||
|
it will be translated to a stream event, and the process will continue to
|
||||||
|
execute. <strong>Even if this <code>Signal</code> instance is dropped, subsequent <code>SIGINT</code>
|
||||||
|
deliveries will end up captured by Tokio, and the default platform behavior
|
||||||
|
will NOT be reset</strong>.</p>
|
||||||
|
<p>Thus, applications should take care to ensure the expected signal behavior
|
||||||
|
occurs as expected after listening for specific signals.</p>
|
||||||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::signal;
|
||||||
|
|
||||||
|
<span class="attr">#[tokio::main]
|
||||||
|
</span><span class="kw">async fn </span>main() {
|
||||||
|
<span class="macro">println!</span>(<span class="string">"waiting for ctrl-c"</span>);
|
||||||
|
|
||||||
|
signal::ctrl_c().<span class="kw">await</span>.expect(<span class="string">"failed to listen for event"</span>);
|
||||||
|
|
||||||
|
<span class="macro">println!</span>(<span class="string">"received ctrl-c event"</span>);
|
||||||
|
}</code></pre></div>
|
||||||
|
<p>Listen in the background:</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>tokio::spawn(<span class="kw">async move </span>{
|
||||||
|
tokio::signal::ctrl_c().<span class="kw">await</span>.unwrap();
|
||||||
|
<span class="comment">// Your handler here
|
||||||
|
</span>});</code></pre></div>
|
||||||
|
</div></details></section></div></main></body></html>
|
2
actix_rt/signal/index.html
Normal file
2
actix_rt/signal/index.html
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<!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="Asynchronous signal handling (Tokio re-exports)."><title>actix_rt::signal - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module signal</a></h2><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate actix_<wbr>rt</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_rt</a></span><h1>Module <span>signal</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/actix_rt/lib.rs.html#75">source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Asynchronous signal handling (Tokio re-exports).</p>
|
||||||
|
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="unix/index.html" title="mod actix_rt::signal::unix">unix</a></div><div class="desc docblock-short">Unix specific signals (Tokio re-exports).</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.ctrl_c.html" title="fn actix_rt::signal::ctrl_c">ctrl_c</a></div><div class="desc docblock-short">Completes when a “ctrl-c” notification is sent to the process.</div></li></ul></section></div></main></body></html>
|
1
actix_rt/signal/sidebar-items.js
Normal file
1
actix_rt/signal/sidebar-items.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
window.SIDEBAR_ITEMS = {"fn":["ctrl_c"],"mod":["unix"]};
|
25
actix_rt/signal/unix/fn.signal.html
Normal file
25
actix_rt/signal/unix/fn.signal.html
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<!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="Creates a new listener which will receive notifications when the current process receives the specified signal `kind`."><title>signal in actix_rt::signal::unix - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">signal</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#errors" title="Errors">Errors</a></li><li><a href="#panics" title="Panics">Panics</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In actix_<wbr>rt::<wbr>signal::<wbr>unix</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../../index.html">actix_rt</a>::<wbr><a href="../index.html">signal</a>::<wbr><a href="index.html">unix</a></span><h1>Function <span class="fn">signal</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub fn signal(kind: <a class="struct" href="struct.SignalKind.html" title="struct actix_rt::signal::unix::SignalKind">SignalKind</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Signal.html" title="struct actix_rt::signal::unix::Signal">Signal</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Creates a new listener which will receive notifications when the current
|
||||||
|
process receives the specified signal <code>kind</code>.</p>
|
||||||
|
<p>This function will create a new stream which binds to the default reactor.
|
||||||
|
The <code>Signal</code> stream is an infinite stream which will receive
|
||||||
|
notifications whenever a signal is received. More documentation can be
|
||||||
|
found on <code>Signal</code> itself, but to reiterate:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Signals may be coalesced beyond what the kernel already does.</li>
|
||||||
|
<li>Once a signal handler is registered with the process the underlying
|
||||||
|
libc signal handler is never unregistered.</li>
|
||||||
|
</ul>
|
||||||
|
<p>A <code>Signal</code> stream can be created for a particular signal number
|
||||||
|
multiple times. When a signal is received then all the associated
|
||||||
|
channels will receive the signal notification.</p>
|
||||||
|
<h2 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h2>
|
||||||
|
<ul>
|
||||||
|
<li>If the lower-level C functions fail for some reason.</li>
|
||||||
|
<li>If the previous initialization of this specific signal failed.</li>
|
||||||
|
<li>If the signal is one of
|
||||||
|
<a href="fn@signal_hook_registry::register#panics"><code>signal_hook::FORBIDDEN</code></a></li>
|
||||||
|
</ul>
|
||||||
|
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
|
||||||
|
<p>This function panics if there is no current reactor set, or if the <code>rt</code>
|
||||||
|
feature flag is not enabled.</p>
|
||||||
|
</div></details></section></div></main></body></html>
|
3
actix_rt/signal/unix/index.html
Normal file
3
actix_rt/signal/unix/index.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<!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="Unix specific signals (Tokio re-exports)."><title>actix_rt::signal::unix - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module unix</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In actix_<wbr>rt::<wbr>signal</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../../index.html">actix_rt</a>::<wbr><a href="../index.html">signal</a></span><h1>Module <span>unix</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/actix_rt/lib.rs.html#79">source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Unix specific signals (Tokio re-exports).</p>
|
||||||
|
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Signal.html" title="struct actix_rt::signal::unix::Signal">Signal</a></div><div class="desc docblock-short">An listener for receiving a particular type of OS signal.</div></li><li><div class="item-name"><a class="struct" href="struct.SignalKind.html" title="struct actix_rt::signal::unix::SignalKind">Signal<wbr>Kind</a></div><div class="desc docblock-short">Represents the specific kind of signal to listen for.</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.signal.html" title="fn actix_rt::signal::unix::signal">signal</a></div><div class="desc docblock-short">Creates a new listener which will receive notifications when the current
|
||||||
|
process receives the specified signal <code>kind</code>.</div></li></ul></section></div></main></body></html>
|
1
actix_rt/signal/unix/sidebar-items.js
Normal file
1
actix_rt/signal/unix/sidebar-items.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
window.SIDEBAR_ITEMS = {"fn":["signal"],"struct":["Signal","SignalKind"]};
|
119
actix_rt/signal/unix/struct.Signal.html
Normal file
119
actix_rt/signal/unix/struct.Signal.html
Normal file
File diff suppressed because one or more lines are too long
63
actix_rt/signal/unix/struct.SignalKind.html
Normal file
63
actix_rt/signal/unix/struct.SignalKind.html
Normal file
File diff suppressed because one or more lines are too long
37
actix_rt/struct.Arbiter.html
Normal file
37
actix_rt/struct.Arbiter.html
Normal file
File diff suppressed because one or more lines are too long
26
actix_rt/struct.ArbiterHandle.html
Normal file
26
actix_rt/struct.ArbiterHandle.html
Normal file
File diff suppressed because one or more lines are too long
85
actix_rt/struct.Runtime.html
Normal file
85
actix_rt/struct.Runtime.html
Normal file
File diff suppressed because one or more lines are too long
29
actix_rt/struct.System.html
Normal file
29
actix_rt/struct.System.html
Normal file
File diff suppressed because one or more lines are too long
15
actix_rt/struct.SystemRunner.html
Normal file
15
actix_rt/struct.SystemRunner.html
Normal file
File diff suppressed because one or more lines are too long
11
actix_rt/system/struct.System.html
Normal file
11
actix_rt/system/struct.System.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_rt/struct.System.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_rt/struct.System.html">../../actix_rt/struct.System.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_rt/struct.System.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
11
actix_rt/system/struct.SystemRunner.html
Normal file
11
actix_rt/system/struct.SystemRunner.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_rt/struct.SystemRunner.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_rt/struct.SystemRunner.html">../../actix_rt/struct.SystemRunner.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_rt/struct.SystemRunner.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
86
actix_rt/task/fn.spawn_blocking.html
Normal file
86
actix_rt/task/fn.spawn_blocking.html
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<!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="Runs the provided closure on a thread where blocking is acceptable."><title>spawn_blocking in actix_rt::task - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">spawn_<wbr>blocking</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#related-apis-and-patterns-for-bridging-asynchronous-and-blocking-code" title="Related APIs and patterns for bridging asynchronous and blocking code">Related APIs and patterns for bridging asynchronous and blocking code</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In actix_<wbr>rt::<wbr>task</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_rt</a>::<wbr><a href="index.html">task</a></span><h1>Function <span class="fn">spawn_blocking</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub fn spawn_blocking<F, R>(f: F) -> <a class="struct" href="struct.JoinHandle.html" title="struct actix_rt::task::JoinHandle">JoinHandle</a><R> <a href="#" class="tooltip" data-notable-ty="JoinHandle<R>">ⓘ</a><div class="where">where
|
||||||
|
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>() -> R + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,
|
||||||
|
R: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Runs the provided closure on a thread where blocking is acceptable.</p>
|
||||||
|
<p>In general, issuing a blocking call or performing a lot of compute in a
|
||||||
|
future without yielding is problematic, as it may prevent the executor from
|
||||||
|
driving other futures forward. This function runs the provided closure on a
|
||||||
|
thread dedicated to blocking operations. See the <a href="../index.html#cpu-bound-tasks-and-blocking-code">CPU-bound tasks and
|
||||||
|
blocking code</a> section for more information.</p>
|
||||||
|
<p>Tokio will spawn more blocking threads when they are requested through this
|
||||||
|
function until the upper limit configured on the <a href="struct@crate::runtime::Builder"><code>Builder</code></a> is reached.
|
||||||
|
After reaching the upper limit, the tasks are put in a queue.
|
||||||
|
The thread limit is very large by default, because <code>spawn_blocking</code> is often
|
||||||
|
used for various kinds of IO operations that cannot be performed
|
||||||
|
asynchronously. When you run CPU-bound code using <code>spawn_blocking</code>, you
|
||||||
|
should keep this large upper limit in mind. When running many CPU-bound
|
||||||
|
computations, a semaphore or some other synchronization primitive should be
|
||||||
|
used to limit the number of computation executed in parallel. Specialized
|
||||||
|
CPU-bound executors, such as <a href="https://docs.rs/rayon">rayon</a>, may also be a good fit.</p>
|
||||||
|
<p>This function is intended for non-async operations that eventually finish on
|
||||||
|
their own. If you want to spawn an ordinary thread, you should use
|
||||||
|
<a href="https://doc.rust-lang.org/nightly/std/thread/fn.spawn.html" title="fn std::thread::spawn"><code>thread::spawn</code></a> instead.</p>
|
||||||
|
<p>Be aware that tasks spawned using <code>spawn_blocking</code> cannot be aborted
|
||||||
|
because they are not async. If you call <a href="struct.JoinHandle.html#method.abort" title="method actix_rt::task::JoinHandle::abort"><code>abort</code></a> on a <code>spawn_blocking</code>
|
||||||
|
task, then this <em>will not have any effect</em>, and the task will continue
|
||||||
|
running normally. The exception is if the task has not started running
|
||||||
|
yet; in that case, calling <code>abort</code> may prevent the task from starting.</p>
|
||||||
|
<p>When you shut down the executor, it will wait indefinitely for all blocking operations to
|
||||||
|
finish. You can use <a href="fn@crate::runtime::Runtime::shutdown_timeout"><code>shutdown_timeout</code></a> to stop waiting for them after a
|
||||||
|
certain timeout. Be aware that this will still not cancel the tasks — they
|
||||||
|
are simply allowed to keep running after the method returns. It is possible
|
||||||
|
for a blocking task to be cancelled if it has not yet started running, but this
|
||||||
|
is not guaranteed.</p>
|
||||||
|
<p>Note that if you are using the single threaded runtime, this function will
|
||||||
|
still spawn additional threads for blocking operations. The current-thread
|
||||||
|
scheduler’s single thread is only used for asynchronous code.</p>
|
||||||
|
<h2 id="related-apis-and-patterns-for-bridging-asynchronous-and-blocking-code"><a class="doc-anchor" href="#related-apis-and-patterns-for-bridging-asynchronous-and-blocking-code">§</a>Related APIs and patterns for bridging asynchronous and blocking code</h2>
|
||||||
|
<p>In simple cases, it is sufficient to have the closure accept input
|
||||||
|
parameters at creation time and return a single value (or struct/tuple, etc.).</p>
|
||||||
|
<p>For more complex situations in which it is desirable to stream data to or from
|
||||||
|
the synchronous context, the <a href="crate::sync::mpsc"><code>mpsc channel</code></a> has <code>blocking_send</code> and
|
||||||
|
<code>blocking_recv</code> methods for use in non-async code such as the thread created
|
||||||
|
by <code>spawn_blocking</code>.</p>
|
||||||
|
<p>Another option is <a href="https://docs.rs/tokio-util/latest/tokio_util/io/struct.SyncIoBridge.html"><code>SyncIoBridge</code></a> for cases where the synchronous context
|
||||||
|
is operating on byte streams. For example, you might use an asynchronous
|
||||||
|
HTTP client such as <a href="https://docs.rs/hyper">hyper</a> to fetch data, but perform complex parsing
|
||||||
|
of the payload body using a library written for synchronous I/O.</p>
|
||||||
|
<p>Finally, see also <a href="https://tokio.rs/tokio/topics/bridging">Bridging with sync code</a> for discussions
|
||||||
|
around the opposite case of using Tokio as part of a larger synchronous
|
||||||
|
codebase.</p>
|
||||||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||||
|
<p>Pass an input value and receive result of computation:</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::task;
|
||||||
|
|
||||||
|
<span class="comment">// Initial input
|
||||||
|
</span><span class="kw">let </span><span class="kw-2">mut </span>v = <span class="string">"Hello, "</span>.to_string();
|
||||||
|
<span class="kw">let </span>res = task::spawn_blocking(<span class="kw">move </span>|| {
|
||||||
|
<span class="comment">// Stand-in for compute-heavy work or using synchronous APIs
|
||||||
|
</span>v.push_str(<span class="string">"world"</span>);
|
||||||
|
<span class="comment">// Pass ownership of the value back to the asynchronous context
|
||||||
|
</span>v
|
||||||
|
}).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||||
|
|
||||||
|
<span class="comment">// `res` is the value returned from the thread
|
||||||
|
</span><span class="macro">assert_eq!</span>(res.as_str(), <span class="string">"Hello, world"</span>);</code></pre></div>
|
||||||
|
<p>Use a channel:</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::task;
|
||||||
|
<span class="kw">use </span>tokio::sync::mpsc;
|
||||||
|
|
||||||
|
<span class="kw">let </span>(tx, <span class="kw-2">mut </span>rx) = mpsc::channel(<span class="number">2</span>);
|
||||||
|
<span class="kw">let </span>start = <span class="number">5</span>;
|
||||||
|
<span class="kw">let </span>worker = task::spawn_blocking(<span class="kw">move </span>|| {
|
||||||
|
<span class="kw">for </span>x <span class="kw">in </span><span class="number">0</span>..<span class="number">10 </span>{
|
||||||
|
<span class="comment">// Stand in for complex computation
|
||||||
|
</span>tx.blocking_send(start + x).unwrap();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>acc = <span class="number">0</span>;
|
||||||
|
<span class="kw">while let </span><span class="prelude-val">Some</span>(v) = rx.recv().<span class="kw">await </span>{
|
||||||
|
acc += v;
|
||||||
|
}
|
||||||
|
<span class="macro">assert_eq!</span>(acc, <span class="number">95</span>);
|
||||||
|
worker.<span class="kw">await</span>.unwrap();</code></pre></div>
|
||||||
|
</div></details><script type="text/json" id="notable-traits-data">{"JoinHandle<R>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.JoinHandle.html\" title=\"struct actix_rt::task::JoinHandle\">JoinHandle</a><T></code></h3><pre><code><div class=\"where\">impl<T> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.JoinHandle.html\" title=\"struct actix_rt::task::JoinHandle\">JoinHandle</a><T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <a class=\"enum\" href=\"https://doc.rust-lang.org/nightly/core/result/enum.Result.html\" title=\"enum core::result::Result\">Result</a><T, <a class=\"struct\" href=\"struct.JoinError.html\" title=\"struct actix_rt::task::JoinError\">JoinError</a>>;</div>"}</script></section></div></main></body></html>
|
24
actix_rt/task/fn.yield_now.html
Normal file
24
actix_rt/task/fn.yield_now.html
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<!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="Yields execution back to the Tokio runtime."><title>yield_now in actix_rt::task - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">yield_<wbr>now</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#non-guarantees" title="Non-guarantees">Non-guarantees</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In actix_<wbr>rt::<wbr>task</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_rt</a>::<wbr><a href="index.html">task</a></span><h1>Function <span class="fn">yield_now</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub async fn yield_now()</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Yields execution back to the Tokio runtime.</p>
|
||||||
|
<p>A task yields by awaiting on <code>yield_now()</code>, and may resume when that future
|
||||||
|
completes (with no output.) The current task will be re-added as a pending
|
||||||
|
task at the <em>back</em> of the pending queue. Any other pending tasks will be
|
||||||
|
scheduled. No other waking is required for the task to continue.</p>
|
||||||
|
<p>See also the usage example in the <a href="index.html#yield_now">task module</a>.</p>
|
||||||
|
<h3 id="non-guarantees"><a class="doc-anchor" href="#non-guarantees">§</a>Non-guarantees</h3>
|
||||||
|
<p>This function may not yield all the way up to the executor if there are any
|
||||||
|
special combinators above it in the call stack. For example, if a
|
||||||
|
<a href="macro@crate::select"><code>tokio::select!</code></a> has another branch complete during the same poll as the
|
||||||
|
<code>yield_now()</code>, then the yield is not propagated all the way up to the
|
||||||
|
runtime.</p>
|
||||||
|
<p>It is generally not guaranteed that the runtime behaves like you expect it
|
||||||
|
to when deciding which task to schedule next after a call to <code>yield_now()</code>.
|
||||||
|
In particular, the runtime may choose to poll the task that just ran
|
||||||
|
<code>yield_now()</code> again immediately without polling any other tasks first. For
|
||||||
|
example, the runtime will not drive the IO driver between every poll of a
|
||||||
|
task, and this could result in the runtime polling the current task again
|
||||||
|
immediately even if there is another task that could make progress if that
|
||||||
|
other task is waiting for a notification from the IO driver.</p>
|
||||||
|
<p>In general, changes to the order in which the runtime polls tasks is not
|
||||||
|
considered a breaking change, and your program should be correct no matter
|
||||||
|
which order the runtime polls your tasks in.</p>
|
||||||
|
</div></details></section></div></main></body></html>
|
2
actix_rt/task/index.html
Normal file
2
actix_rt/task/index.html
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<!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="Task management (Tokio re-exports)."><title>actix_rt::task - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module task</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate actix_<wbr>rt</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_rt</a></span><h1>Module <span>task</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/actix_rt/lib.rs.html#165">source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Task management (Tokio re-exports).</p>
|
||||||
|
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.JoinError.html" title="struct actix_rt::task::JoinError">Join<wbr>Error</a></div><div class="desc docblock-short">Task failed to execute to completion.</div></li><li><div class="item-name"><a class="struct" href="struct.JoinHandle.html" title="struct actix_rt::task::JoinHandle">Join<wbr>Handle</a></div><div class="desc docblock-short">An owned permission to join on a task (await its termination).</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.spawn_blocking.html" title="fn actix_rt::task::spawn_blocking">spawn_<wbr>blocking</a></div><div class="desc docblock-short">Runs the provided closure on a thread where blocking is acceptable.</div></li><li><div class="item-name"><a class="fn" href="fn.yield_now.html" title="fn actix_rt::task::yield_now">yield_<wbr>now</a></div><div class="desc docblock-short">Yields execution back to the Tokio runtime.</div></li></ul></section></div></main></body></html>
|
1
actix_rt/task/sidebar-items.js
Normal file
1
actix_rt/task/sidebar-items.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
window.SIDEBAR_ITEMS = {"fn":["spawn_blocking","yield_now"],"struct":["JoinError","JoinHandle"]};
|
63
actix_rt/task/struct.JoinError.html
Normal file
63
actix_rt/task/struct.JoinError.html
Normal file
File diff suppressed because one or more lines are too long
291
actix_rt/task/struct.JoinHandle.html
Normal file
291
actix_rt/task/struct.JoinHandle.html
Normal file
File diff suppressed because one or more lines are too long
48
actix_rt/time/fn.interval.html
Normal file
48
actix_rt/time/fn.interval.html
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<!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="Creates new `Interval` that yields with interval of `period`. The first tick completes immediately. The default `MissedTickBehavior` is `Burst`, but this can be configured by calling `set_missed_tick_behavior`."><title>interval in actix_rt::time - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">interval</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In actix_<wbr>rt::<wbr>time</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_rt</a>::<wbr><a href="index.html">time</a></span><h1>Function <span class="fn">interval</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub fn interval(period: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>) -> <a class="struct" href="struct.Interval.html" title="struct actix_rt::time::Interval">Interval</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Creates new <a href="struct.Interval.html" title="struct actix_rt::time::Interval"><code>Interval</code></a> that yields with interval of <code>period</code>. The first
|
||||||
|
tick completes immediately. The default [<code>MissedTickBehavior</code>] is
|
||||||
|
<a href="MissedTickBehavior::Burst"><code>Burst</code></a>, but this can be configured
|
||||||
|
by calling <a href="struct.Interval.html#method.set_missed_tick_behavior" title="method actix_rt::time::Interval::set_missed_tick_behavior"><code>set_missed_tick_behavior</code></a>.</p>
|
||||||
|
<p>An interval will tick indefinitely. At any time, the <a href="struct.Interval.html" title="struct actix_rt::time::Interval"><code>Interval</code></a> value can
|
||||||
|
be dropped. This cancels the interval.</p>
|
||||||
|
<p>This function is equivalent to
|
||||||
|
<a href="fn.interval_at.html" title="fn actix_rt::time::interval_at"><code>interval_at(Instant::now(), period)</code></a>.</p>
|
||||||
|
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
|
||||||
|
<p>This function panics if <code>period</code> is zero.</p>
|
||||||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::time::{<span class="self">self</span>, Duration};
|
||||||
|
|
||||||
|
<span class="attr">#[tokio::main]
|
||||||
|
</span><span class="kw">async fn </span>main() {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>interval = time::interval(Duration::from_millis(<span class="number">10</span>));
|
||||||
|
|
||||||
|
interval.tick().<span class="kw">await</span>; <span class="comment">// ticks immediately
|
||||||
|
</span>interval.tick().<span class="kw">await</span>; <span class="comment">// ticks after 10ms
|
||||||
|
</span>interval.tick().<span class="kw">await</span>; <span class="comment">// ticks after 10ms
|
||||||
|
|
||||||
|
// approximately 20ms have elapsed.
|
||||||
|
</span>}</code></pre></div>
|
||||||
|
<p>A simple example using <code>interval</code> to execute a task every two seconds.</p>
|
||||||
|
<p>The difference between <code>interval</code> and <a href="fn.sleep.html" title="fn actix_rt::time::sleep"><code>sleep</code></a> is that an <a href="struct.Interval.html" title="struct actix_rt::time::Interval"><code>Interval</code></a>
|
||||||
|
measures the time since the last tick, which means that <a href="struct.Interval.html#method.tick" title="method actix_rt::time::Interval::tick"><code>.tick().await</code></a>
|
||||||
|
may wait for a shorter time than the duration specified for the interval
|
||||||
|
if some time has passed between calls to <a href="struct.Interval.html#method.tick" title="method actix_rt::time::Interval::tick"><code>.tick().await</code></a>.</p>
|
||||||
|
<p>If the tick in the example below was replaced with <a href="fn.sleep.html" title="fn actix_rt::time::sleep"><code>sleep</code></a>, the task
|
||||||
|
would only be executed once every three seconds, and not every two
|
||||||
|
seconds.</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::time;
|
||||||
|
|
||||||
|
<span class="kw">async fn </span>task_that_takes_a_second() {
|
||||||
|
<span class="macro">println!</span>(<span class="string">"hello"</span>);
|
||||||
|
time::sleep(time::Duration::from_secs(<span class="number">1</span>)).<span class="kw">await
|
||||||
|
</span>}
|
||||||
|
|
||||||
|
<span class="attr">#[tokio::main]
|
||||||
|
</span><span class="kw">async fn </span>main() {
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>interval = time::interval(time::Duration::from_secs(<span class="number">2</span>));
|
||||||
|
<span class="kw">for </span>_i <span class="kw">in </span><span class="number">0</span>..<span class="number">5 </span>{
|
||||||
|
interval.tick().<span class="kw">await</span>;
|
||||||
|
task_that_takes_a_second().<span class="kw">await</span>;
|
||||||
|
}
|
||||||
|
}</code></pre></div>
|
||||||
|
</div></details></section></div></main></body></html>
|
23
actix_rt/time/fn.interval_at.html
Normal file
23
actix_rt/time/fn.interval_at.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<!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="Creates new `Interval` that yields with interval of `period` with the first tick completing at `start`. The default `MissedTickBehavior` is `Burst`, but this can be configured by calling `set_missed_tick_behavior`."><title>interval_at in actix_rt::time - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">interval_<wbr>at</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#panics" title="Panics">Panics</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In actix_<wbr>rt::<wbr>time</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_rt</a>::<wbr><a href="index.html">time</a></span><h1>Function <span class="fn">interval_at</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub fn interval_at(start: <a class="struct" href="struct.Instant.html" title="struct actix_rt::time::Instant">Instant</a>, period: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>) -> <a class="struct" href="struct.Interval.html" title="struct actix_rt::time::Interval">Interval</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Creates new <a href="struct.Interval.html" title="struct actix_rt::time::Interval"><code>Interval</code></a> that yields with interval of <code>period</code> with the
|
||||||
|
first tick completing at <code>start</code>. The default [<code>MissedTickBehavior</code>] is
|
||||||
|
<a href="MissedTickBehavior::Burst"><code>Burst</code></a>, but this can be configured
|
||||||
|
by calling <a href="struct.Interval.html#method.set_missed_tick_behavior" title="method actix_rt::time::Interval::set_missed_tick_behavior"><code>set_missed_tick_behavior</code></a>.</p>
|
||||||
|
<p>An interval will tick indefinitely. At any time, the <a href="struct.Interval.html" title="struct actix_rt::time::Interval"><code>Interval</code></a> value can
|
||||||
|
be dropped. This cancels the interval.</p>
|
||||||
|
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
|
||||||
|
<p>This function panics if <code>period</code> is zero.</p>
|
||||||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::time::{interval_at, Duration, Instant};
|
||||||
|
|
||||||
|
<span class="attr">#[tokio::main]
|
||||||
|
</span><span class="kw">async fn </span>main() {
|
||||||
|
<span class="kw">let </span>start = Instant::now() + Duration::from_millis(<span class="number">50</span>);
|
||||||
|
<span class="kw">let </span><span class="kw-2">mut </span>interval = interval_at(start, Duration::from_millis(<span class="number">10</span>));
|
||||||
|
|
||||||
|
interval.tick().<span class="kw">await</span>; <span class="comment">// ticks after 50ms
|
||||||
|
</span>interval.tick().<span class="kw">await</span>; <span class="comment">// ticks after 10ms
|
||||||
|
</span>interval.tick().<span class="kw">await</span>; <span class="comment">// ticks after 10ms
|
||||||
|
|
||||||
|
// approximately 70ms have elapsed.
|
||||||
|
</span>}</code></pre></div>
|
||||||
|
</div></details></section></div></main></body></html>
|
36
actix_rt/time/fn.sleep.html
Normal file
36
actix_rt/time/fn.sleep.html
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<!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="Waits until `duration` has elapsed."><title>sleep in actix_rt::time - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">sleep</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#cancellation" title="Cancellation">Cancellation</a></li><li><a href="#examples" title="Examples">Examples</a></li><li><a href="#panics" title="Panics">Panics</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In actix_<wbr>rt::<wbr>time</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_rt</a>::<wbr><a href="index.html">time</a></span><h1>Function <span class="fn">sleep</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub fn sleep(duration: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>) -> <a class="struct" href="struct.Sleep.html" title="struct actix_rt::time::Sleep">Sleep</a> <a href="#" class="tooltip" data-notable-ty="Sleep">ⓘ</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Waits until <code>duration</code> has elapsed.</p>
|
||||||
|
<p>Equivalent to <code>sleep_until(Instant::now() + duration)</code>. An asynchronous
|
||||||
|
analog to <code>std::thread::sleep</code>.</p>
|
||||||
|
<p>No work is performed while awaiting on the sleep future to complete. <code>Sleep</code>
|
||||||
|
operates at millisecond granularity and should not be used for tasks that
|
||||||
|
require high-resolution timers. The implementation is platform specific,
|
||||||
|
and some platforms (specifically Windows) will provide timers with a
|
||||||
|
larger resolution than 1 ms.</p>
|
||||||
|
<p>To run something regularly on a schedule, see <a href="fn.interval.html" title="fn actix_rt::time::interval"><code>interval</code></a>.</p>
|
||||||
|
<p>The maximum duration for a sleep is 68719476734 milliseconds (approximately 2.2 years).</p>
|
||||||
|
<h2 id="cancellation"><a class="doc-anchor" href="#cancellation">§</a>Cancellation</h2>
|
||||||
|
<p>Canceling a sleep instance is done by dropping the returned future. No additional
|
||||||
|
cleanup work is required.</p>
|
||||||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||||
|
<p>Wait 100ms and print “100 ms have elapsed”.</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::time::{sleep, Duration};
|
||||||
|
|
||||||
|
<span class="attr">#[tokio::main]
|
||||||
|
</span><span class="kw">async fn </span>main() {
|
||||||
|
sleep(Duration::from_millis(<span class="number">100</span>)).<span class="kw">await</span>;
|
||||||
|
<span class="macro">println!</span>(<span class="string">"100 ms have elapsed"</span>);
|
||||||
|
}</code></pre></div>
|
||||||
|
<p>See the documentation for the <a href="struct.Sleep.html" title="struct actix_rt::time::Sleep"><code>Sleep</code></a> type for more examples.</p>
|
||||||
|
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
|
||||||
|
<p>This function panics if there is no current timer set.</p>
|
||||||
|
<p>It can be triggered when <a href="crate::runtime::Builder::enable_time"><code>Builder::enable_time</code></a> or
|
||||||
|
<a href="crate::runtime::Builder::enable_all"><code>Builder::enable_all</code></a> are not included in the builder.</p>
|
||||||
|
<p>It can also panic whenever a timer is created outside of a
|
||||||
|
Tokio runtime. That is why <code>rt.block_on(sleep(...))</code> will panic,
|
||||||
|
since the function is executed outside of the runtime.
|
||||||
|
Whereas <code>rt.block_on(async {sleep(...).await})</code> doesn’t panic.
|
||||||
|
And this is because wrapping the function on an async makes it lazy,
|
||||||
|
and so gets executed inside the runtime successfully without
|
||||||
|
panicking.</p>
|
||||||
|
</div></details><script type="text/json" id="notable-traits-data">{"Sleep":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Sleep.html\" title=\"struct actix_rt::time::Sleep\">Sleep</a></code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.Sleep.html\" title=\"struct actix_rt::time::Sleep\">Sleep</a></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.unit.html\">()</a>;</div>"}</script></section></div></main></body></html>
|
31
actix_rt/time/fn.sleep_until.html
Normal file
31
actix_rt/time/fn.sleep_until.html
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<!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="Waits until `deadline` is reached."><title>sleep_until in actix_rt::time - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">sleep_<wbr>until</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#cancellation" title="Cancellation">Cancellation</a></li><li><a href="#examples" title="Examples">Examples</a></li><li><a href="#panics" title="Panics">Panics</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In actix_<wbr>rt::<wbr>time</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_rt</a>::<wbr><a href="index.html">time</a></span><h1>Function <span class="fn">sleep_until</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub fn sleep_until(deadline: <a class="struct" href="struct.Instant.html" title="struct actix_rt::time::Instant">Instant</a>) -> <a class="struct" href="struct.Sleep.html" title="struct actix_rt::time::Sleep">Sleep</a> <a href="#" class="tooltip" data-notable-ty="Sleep">ⓘ</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Waits until <code>deadline</code> is reached.</p>
|
||||||
|
<p>No work is performed while awaiting on the sleep future to complete. <code>Sleep</code>
|
||||||
|
operates at millisecond granularity and should not be used for tasks that
|
||||||
|
require high-resolution timers.</p>
|
||||||
|
<p>To run something regularly on a schedule, see <a href="fn.interval.html" title="fn actix_rt::time::interval"><code>interval</code></a>.</p>
|
||||||
|
<h2 id="cancellation"><a class="doc-anchor" href="#cancellation">§</a>Cancellation</h2>
|
||||||
|
<p>Canceling a sleep instance is done by dropping the returned future. No additional
|
||||||
|
cleanup work is required.</p>
|
||||||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||||
|
<p>Wait 100ms and print “100 ms have elapsed”.</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::time::{sleep_until, Instant, Duration};
|
||||||
|
|
||||||
|
<span class="attr">#[tokio::main]
|
||||||
|
</span><span class="kw">async fn </span>main() {
|
||||||
|
sleep_until(Instant::now() + Duration::from_millis(<span class="number">100</span>)).<span class="kw">await</span>;
|
||||||
|
<span class="macro">println!</span>(<span class="string">"100 ms have elapsed"</span>);
|
||||||
|
}</code></pre></div>
|
||||||
|
<p>See the documentation for the <a href="struct.Sleep.html" title="struct actix_rt::time::Sleep"><code>Sleep</code></a> type for more examples.</p>
|
||||||
|
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
|
||||||
|
<p>This function panics if there is no current timer set.</p>
|
||||||
|
<p>It can be triggered when <a href="crate::runtime::Builder::enable_time"><code>Builder::enable_time</code></a> or
|
||||||
|
<a href="crate::runtime::Builder::enable_all"><code>Builder::enable_all</code></a> are not included in the builder.</p>
|
||||||
|
<p>It can also panic whenever a timer is created outside of a
|
||||||
|
Tokio runtime. That is why <code>rt.block_on(sleep(...))</code> will panic,
|
||||||
|
since the function is executed outside of the runtime.
|
||||||
|
Whereas <code>rt.block_on(async {sleep(...).await})</code> doesn’t panic.
|
||||||
|
And this is because wrapping the function on an async makes it lazy,
|
||||||
|
and so gets executed inside the runtime successfully without
|
||||||
|
panicking.</p>
|
||||||
|
</div></details><script type="text/json" id="notable-traits-data">{"Sleep":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Sleep.html\" title=\"struct actix_rt::time::Sleep\">Sleep</a></code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.Sleep.html\" title=\"struct actix_rt::time::Sleep\">Sleep</a></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.unit.html\">()</a>;</div>"}</script></section></div></main></body></html>
|
47
actix_rt/time/fn.timeout.html
Normal file
47
actix_rt/time/fn.timeout.html
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<!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="Requires a `Future` to complete before the specified duration has elapsed."><title>timeout in actix_rt::time - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">timeout</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#cancellation" title="Cancellation">Cancellation</a></li><li><a href="#examples" title="Examples">Examples</a></li><li><a href="#panics" title="Panics">Panics</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In actix_<wbr>rt::<wbr>time</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_rt</a>::<wbr><a href="index.html">time</a></span><h1>Function <span class="fn">timeout</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub fn timeout<F>(
|
||||||
|
duration: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>,
|
||||||
|
future: F,
|
||||||
|
) -> <a class="struct" href="struct.Timeout.html" title="struct actix_rt::time::Timeout">Timeout</a><<F as <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html" title="trait core::future::into_future::IntoFuture">IntoFuture</a>>::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html#associatedtype.IntoFuture" title="type core::future::into_future::IntoFuture::IntoFuture">IntoFuture</a>> <a href="#" class="tooltip" data-notable-ty="Timeout<<F as IntoFuture>::IntoFuture>">ⓘ</a><div class="where">where
|
||||||
|
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html" title="trait core::future::into_future::IntoFuture">IntoFuture</a>,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Requires a <code>Future</code> to complete before the specified duration has elapsed.</p>
|
||||||
|
<p>If the future completes before the duration has elapsed, then the completed
|
||||||
|
value is returned. Otherwise, an error is returned and the future is
|
||||||
|
canceled.</p>
|
||||||
|
<p>Note that the timeout is checked before polling the future, so if the future
|
||||||
|
does not yield during execution then it is possible for the future to complete
|
||||||
|
and exceed the timeout <em>without</em> returning an error.</p>
|
||||||
|
<p>This function returns a future whose return type is <a href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result"><code>Result</code></a><code><T,</code><a href="crate::time::error::Elapsed"><code>Elapsed</code></a><code>></code>, where <code>T</code> is the
|
||||||
|
return type of the provided future.</p>
|
||||||
|
<p>If the provided future completes immediately, then the future returned from
|
||||||
|
this function is guaranteed to complete immediately with an <a href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html#variant.Ok" title="variant core::result::Result::Ok"><code>Ok</code></a> variant
|
||||||
|
no matter the provided duration.</p>
|
||||||
|
<h2 id="cancellation"><a class="doc-anchor" href="#cancellation">§</a>Cancellation</h2>
|
||||||
|
<p>Cancelling a timeout is done by dropping the future. No additional cleanup
|
||||||
|
or other work is required.</p>
|
||||||
|
<p>The original future may be obtained by calling <a href="struct.Timeout.html#method.into_inner" title="method actix_rt::time::Timeout::into_inner"><code>Timeout::into_inner</code></a>. This
|
||||||
|
consumes the <code>Timeout</code>.</p>
|
||||||
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||||
|
<p>Create a new <code>Timeout</code> set to expire in 10 milliseconds.</p>
|
||||||
|
|
||||||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::time::timeout;
|
||||||
|
<span class="kw">use </span>tokio::sync::oneshot;
|
||||||
|
|
||||||
|
<span class="kw">use </span>std::time::Duration;
|
||||||
|
|
||||||
|
<span class="kw">let </span>(tx, rx) = oneshot::channel();
|
||||||
|
|
||||||
|
<span class="comment">// Wrap the future with a `Timeout` set to expire in 10 milliseconds.
|
||||||
|
</span><span class="kw">if let </span><span class="prelude-val">Err</span>(<span class="kw">_</span>) = timeout(Duration::from_millis(<span class="number">10</span>), rx).<span class="kw">await </span>{
|
||||||
|
<span class="macro">println!</span>(<span class="string">"did not receive value within 10 ms"</span>);
|
||||||
|
}</code></pre></div>
|
||||||
|
<h2 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h2>
|
||||||
|
<p>This function panics if there is no current timer set.</p>
|
||||||
|
<p>It can be triggered when <a href="crate::runtime::Builder::enable_time"><code>Builder::enable_time</code></a> or
|
||||||
|
<a href="crate::runtime::Builder::enable_all"><code>Builder::enable_all</code></a> are not included in the builder.</p>
|
||||||
|
<p>It can also panic whenever a timer is created outside of a
|
||||||
|
Tokio runtime. That is why <code>rt.block_on(sleep(...))</code> will panic,
|
||||||
|
since the function is executed outside of the runtime.
|
||||||
|
Whereas <code>rt.block_on(async {sleep(...).await})</code> doesn’t panic.
|
||||||
|
And this is because wrapping the function on an async makes it lazy,
|
||||||
|
and so gets executed inside the runtime successfully without
|
||||||
|
panicking.</p>
|
||||||
|
</div></details><script type="text/json" id="notable-traits-data">{"Timeout<<F as IntoFuture>::IntoFuture>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Timeout.html\" title=\"struct actix_rt::time::Timeout\">Timeout</a><T></code></h3><pre><code><div class=\"where\">impl<T> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.Timeout.html\" title=\"struct actix_rt::time::Timeout\">Timeout</a><T><div class=\"where\">where\n T: <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <a class=\"enum\" href=\"https://doc.rust-lang.org/nightly/core/result/enum.Result.html\" title=\"enum core::result::Result\">Result</a><<T as <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>, Elapsed>;</div>"}</script></section></div></main></body></html>
|
9
actix_rt/time/index.html
Normal file
9
actix_rt/time/index.html
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<!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="Utilities for tracking time (Tokio re-exports)."><title>actix_rt::time - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module time</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate actix_<wbr>rt</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_rt</a></span><h1>Module <span>time</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/actix_rt/lib.rs.html#157">source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Utilities for tracking time (Tokio re-exports).</p>
|
||||||
|
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Instant.html" title="struct actix_rt::time::Instant">Instant</a></div><div class="desc docblock-short">A measurement of a monotonically nondecreasing clock.
|
||||||
|
Opaque and useful only with <code>Duration</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.Interval.html" title="struct actix_rt::time::Interval">Interval</a></div><div class="desc docblock-short">Interval returned by <a href="fn.interval.html" title="fn actix_rt::time::interval"><code>interval</code></a> and <a href="fn.interval_at.html" title="fn actix_rt::time::interval_at"><code>interval_at</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.Sleep.html" title="struct actix_rt::time::Sleep">Sleep</a></div><div class="desc docblock-short">Future returned by <a href="fn.sleep.html" title="fn actix_rt::time::sleep"><code>sleep</code></a> and <a href="fn.sleep_until.html" title="fn actix_rt::time::sleep_until"><code>sleep_until</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.Timeout.html" title="struct actix_rt::time::Timeout">Timeout</a></div><div class="desc docblock-short">Future returned by <a href="fn.timeout.html" title="fn actix_rt::time::timeout"><code>timeout</code></a> and <a href="timeout_at"><code>timeout_at</code></a>.</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.interval.html" title="fn actix_rt::time::interval">interval</a></div><div class="desc docblock-short">Creates new <a href="struct.Interval.html" title="struct actix_rt::time::Interval"><code>Interval</code></a> that yields with interval of <code>period</code>. The first
|
||||||
|
tick completes immediately. The default [<code>MissedTickBehavior</code>] is
|
||||||
|
<a href="MissedTickBehavior::Burst"><code>Burst</code></a>, but this can be configured
|
||||||
|
by calling <a href="struct.Interval.html#method.set_missed_tick_behavior" title="method actix_rt::time::Interval::set_missed_tick_behavior"><code>set_missed_tick_behavior</code></a>.</div></li><li><div class="item-name"><a class="fn" href="fn.interval_at.html" title="fn actix_rt::time::interval_at">interval_<wbr>at</a></div><div class="desc docblock-short">Creates new <a href="struct.Interval.html" title="struct actix_rt::time::Interval"><code>Interval</code></a> that yields with interval of <code>period</code> with the
|
||||||
|
first tick completing at <code>start</code>. The default [<code>MissedTickBehavior</code>] is
|
||||||
|
<a href="MissedTickBehavior::Burst"><code>Burst</code></a>, but this can be configured
|
||||||
|
by calling <a href="struct.Interval.html#method.set_missed_tick_behavior" title="method actix_rt::time::Interval::set_missed_tick_behavior"><code>set_missed_tick_behavior</code></a>.</div></li><li><div class="item-name"><a class="fn" href="fn.sleep.html" title="fn actix_rt::time::sleep">sleep</a></div><div class="desc docblock-short">Waits until <code>duration</code> has elapsed.</div></li><li><div class="item-name"><a class="fn" href="fn.sleep_until.html" title="fn actix_rt::time::sleep_until">sleep_<wbr>until</a></div><div class="desc docblock-short">Waits until <code>deadline</code> is reached.</div></li><li><div class="item-name"><a class="fn" href="fn.timeout.html" title="fn actix_rt::time::timeout">timeout</a></div><div class="desc docblock-short">Requires a <code>Future</code> to complete before the specified duration has elapsed.</div></li></ul></section></div></main></body></html>
|
1
actix_rt/time/sidebar-items.js
Normal file
1
actix_rt/time/sidebar-items.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
window.SIDEBAR_ITEMS = {"fn":["interval","interval_at","sleep","sleep_until","timeout"],"struct":["Instant","Interval","Sleep","Timeout"]};
|
96
actix_rt/time/struct.Instant.html
Normal file
96
actix_rt/time/struct.Instant.html
Normal file
File diff suppressed because one or more lines are too long
144
actix_rt/time/struct.Interval.html
Normal file
144
actix_rt/time/struct.Interval.html
Normal file
File diff suppressed because one or more lines are too long
152
actix_rt/time/struct.Sleep.html
Normal file
152
actix_rt/time/struct.Sleep.html
Normal file
File diff suppressed because one or more lines are too long
114
actix_rt/time/struct.Timeout.html
Normal file
114
actix_rt/time/struct.Timeout.html
Normal file
File diff suppressed because one or more lines are too long
1
actix_server/all.html
Normal file
1
actix_server/all.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!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="List of all items in this crate"><title>List of all items in this crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_server" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod sys"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_server/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_server/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_server/index.html">actix_<wbr>server</a><span class="version">2.5.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h3><a href="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><h1>List of all items</h1><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.Server.html">Server</a></li><li><a href="struct.ServerBuilder.html">ServerBuilder</a></li><li><a href="struct.ServerHandle.html">ServerHandle</a></li><li><a href="struct.TestServer.html">TestServer</a></li></ul><h3 id="enums">Enums</h3><ul class="all-items"><li><a href="enum.MpTcp.html">MpTcp</a></li></ul></section></div></main></body></html>
|
11
actix_server/builder/enum.MpTcp.html
Normal file
11
actix_server/builder/enum.MpTcp.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_server/enum.MpTcp.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_server/enum.MpTcp.html">../../actix_server/enum.MpTcp.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_server/enum.MpTcp.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
11
actix_server/builder/struct.ServerBuilder.html
Normal file
11
actix_server/builder/struct.ServerBuilder.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_server/struct.ServerBuilder.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_server/struct.ServerBuilder.html">../../actix_server/struct.ServerBuilder.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_server/struct.ServerBuilder.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
29
actix_server/enum.MpTcp.html
Normal file
29
actix_server/enum.MpTcp.html
Normal file
File diff suppressed because one or more lines are too long
11
actix_server/handle/struct.ServerHandle.html
Normal file
11
actix_server/handle/struct.ServerHandle.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_server/struct.ServerHandle.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_server/struct.ServerHandle.html">../../actix_server/struct.ServerHandle.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_server/struct.ServerHandle.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
2
actix_server/index.html
Normal file
2
actix_server/index.html
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<!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="General purpose TCP server."><title>actix_server - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_server" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod crate"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_server/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_server/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_server/index.html">actix_<wbr>server</a><span class="version">2.5.0</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#reexports">Crate Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>actix_server</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/actix_server/lib.rs.html#1-36">source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>General purpose TCP server.</p>
|
||||||
|
</div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name" id="reexport.ServerServiceFactory"><code>pub use self::service::ServerServiceFactory;</code></div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Server.html" title="struct actix_server::Server">Server</a></div><div class="desc docblock-short">General purpose TCP server that runs services receiving Tokio <code>TcpStream</code>s.</div></li><li><div class="item-name"><a class="struct" href="struct.ServerBuilder.html" title="struct actix_server::ServerBuilder">Server<wbr>Builder</a></div><div class="desc docblock-short"><a href="struct.Server.html" title="struct actix_server::Server">Server</a> builder.</div></li><li><div class="item-name"><a class="struct" href="struct.ServerHandle.html" title="struct actix_server::ServerHandle">Server<wbr>Handle</a></div><div class="desc docblock-short">Server handle.</div></li><li><div class="item-name"><a class="struct" href="struct.TestServer.html" title="struct actix_server::TestServer">Test<wbr>Server</a></div><div class="desc docblock-short">A testing server.</div></li></ul><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.MpTcp.html" title="enum actix_server::MpTcp">MpTcp</a></div><div class="desc docblock-short">Multipath TCP (MPTCP) preference.</div></li></ul></section></div></main></body></html>
|
11
actix_server/server/struct.Server.html
Normal file
11
actix_server/server/struct.Server.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_server/struct.Server.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_server/struct.Server.html">../../actix_server/struct.Server.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_server/struct.Server.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
1
actix_server/sidebar-items.js
Normal file
1
actix_server/sidebar-items.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
window.SIDEBAR_ITEMS = {"enum":["MpTcp"],"struct":["Server","ServerBuilder","ServerHandle","TestServer"]};
|
169
actix_server/struct.Server.html
Normal file
169
actix_server/struct.Server.html
Normal file
File diff suppressed because one or more lines are too long
107
actix_server/struct.ServerBuilder.html
Normal file
107
actix_server/struct.ServerBuilder.html
Normal file
File diff suppressed because one or more lines are too long
23
actix_server/struct.ServerHandle.html
Normal file
23
actix_server/struct.ServerHandle.html
Normal file
File diff suppressed because one or more lines are too long
40
actix_server/struct.TestServer.html
Normal file
40
actix_server/struct.TestServer.html
Normal file
File diff suppressed because one or more lines are too long
11
actix_server/test_server/struct.TestServer.html
Normal file
11
actix_server/test_server/struct.TestServer.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_server/struct.TestServer.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_server/struct.TestServer.html">../../actix_server/struct.TestServer.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_server/struct.TestServer.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
1
actix_service/all.html
Normal file
1
actix_service/all.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!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="List of all items in this crate"><title>List of all items in this crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_service" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod sys"><!--[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" title="show sidebar"></button><a class="logo-container" href="../actix_service/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_service/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_service/index.html">actix_<wbr>service</a><span class="version">2.0.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h3><a href="#macros">Crate Items</a></h3><ul class="block"><li><a href="#macros" title="Macros">Macros</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><h1>List of all items</h1><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.ApplyTransform.html">ApplyTransform</a></li><li><a href="boxed/struct.BoxServiceFactory.html">boxed::BoxServiceFactory</a></li></ul><h3 id="traits">Traits</h3><ul class="all-items"><li><a href="trait.IntoService.html">IntoService</a></li><li><a href="trait.IntoServiceFactory.html">IntoServiceFactory</a></li><li><a href="trait.Service.html">Service</a></li><li><a href="trait.ServiceExt.html">ServiceExt</a></li><li><a href="trait.ServiceFactory.html">ServiceFactory</a></li><li><a href="trait.ServiceFactoryExt.html">ServiceFactoryExt</a></li><li><a href="trait.Transform.html">Transform</a></li><li><a href="trait.TransformExt.html">TransformExt</a></li></ul><h3 id="macros">Macros</h3><ul class="all-items"><li><a href="macro.always_ready.html">always_ready</a></li><li><a href="macro.forward_ready.html">forward_ready</a></li></ul><h3 id="functions">Functions</h3><ul class="all-items"><li><a href="fn.apply.html">apply</a></li><li><a href="fn.apply_cfg.html">apply_cfg</a></li><li><a href="fn.apply_cfg_factory.html">apply_cfg_factory</a></li><li><a href="fn.apply_fn.html">apply_fn</a></li><li><a href="fn.apply_fn_factory.html">apply_fn_factory</a></li><li><a href="boxed/fn.factory.html">boxed::factory</a></li><li><a href="boxed/fn.rc_service.html">boxed::rc_service</a></li><li><a href="boxed/fn.service.html">boxed::service</a></li><li><a href="fn.fn_factory.html">fn_factory</a></li><li><a href="fn.fn_factory_with_config.html">fn_factory_with_config</a></li><li><a href="fn.fn_service.html">fn_service</a></li><li><a href="fn.into_service.html">into_service</a></li><li><a href="fn.map_config.html">map_config</a></li><li><a href="fn.unit_config.html">unit_config</a></li></ul><h3 id="types">Type Aliases</h3><ul class="all-items"><li><a href="boxed/type.BoxFuture.html">boxed::BoxFuture</a></li><li><a href="boxed/type.BoxService.html">boxed::BoxService</a></li><li><a href="boxed/type.RcService.html">boxed::RcService</a></li></ul></section></div></main></body></html>
|
11
actix_service/apply/fn.apply_fn.html
Normal file
11
actix_service/apply/fn.apply_fn.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_service/fn.apply_fn.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_service/fn.apply_fn.html">../../actix_service/fn.apply_fn.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_service/fn.apply_fn.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
11
actix_service/apply/fn.apply_fn_factory.html
Normal file
11
actix_service/apply/fn.apply_fn_factory.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_service/fn.apply_fn_factory.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_service/fn.apply_fn_factory.html">../../actix_service/fn.apply_fn_factory.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_service/fn.apply_fn_factory.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
11
actix_service/apply_cfg/fn.apply_cfg.html
Normal file
11
actix_service/apply_cfg/fn.apply_cfg.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_service/fn.apply_cfg.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_service/fn.apply_cfg.html">../../actix_service/fn.apply_cfg.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_service/fn.apply_cfg.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
11
actix_service/apply_cfg/fn.apply_cfg_factory.html
Normal file
11
actix_service/apply_cfg/fn.apply_cfg_factory.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0;URL=../../actix_service/fn.apply_cfg_factory.html">
|
||||||
|
<title>Redirection</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to <a href="../../actix_service/fn.apply_cfg_factory.html">../../actix_service/fn.apply_cfg_factory.html</a>...</p>
|
||||||
|
<script>location.replace("../../actix_service/fn.apply_cfg_factory.html" + location.search + location.hash);</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
11
actix_service/boxed/fn.factory.html
Normal file
11
actix_service/boxed/fn.factory.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!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="Wraps a service factory that returns service trait objects."><title>factory in actix_service::boxed - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_service" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_service/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_service/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_service/index.html">actix_<wbr>service</a><span class="version">2.0.2</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In actix_<wbr>service::<wbr>boxed</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_service</a>::<wbr><a href="index.html">boxed</a></span><h1>Function <span class="fn">factory</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/actix_service/boxed.rs.html#67-80">source</a> </span></div><pre class="rust item-decl"><code>pub fn factory<SF, Req>(
|
||||||
|
factory: SF,
|
||||||
|
) -> <a class="struct" href="struct.BoxServiceFactory.html" title="struct actix_service::boxed::BoxServiceFactory">BoxServiceFactory</a><SF::<a class="associatedtype" href="../trait.ServiceFactory.html#associatedtype.Config" title="type actix_service::ServiceFactory::Config">Config</a>, Req, SF::<a class="associatedtype" href="../trait.ServiceFactory.html#associatedtype.Response" title="type actix_service::ServiceFactory::Response">Response</a>, SF::<a class="associatedtype" href="../trait.ServiceFactory.html#associatedtype.Error" title="type actix_service::ServiceFactory::Error">Error</a>, SF::<a class="associatedtype" href="../trait.ServiceFactory.html#associatedtype.InitError" title="type actix_service::ServiceFactory::InitError">InitError</a>><div class="where">where
|
||||||
|
SF: <a class="trait" href="../trait.ServiceFactory.html" title="trait actix_service::ServiceFactory">ServiceFactory</a><Req> + 'static,
|
||||||
|
Req: 'static,
|
||||||
|
SF::<a class="associatedtype" href="../trait.ServiceFactory.html#associatedtype.Response" title="type actix_service::ServiceFactory::Response">Response</a>: 'static,
|
||||||
|
SF::<a class="associatedtype" href="../trait.ServiceFactory.html#associatedtype.Service" title="type actix_service::ServiceFactory::Service">Service</a>: 'static,
|
||||||
|
SF::<a class="associatedtype" href="../trait.ServiceFactory.html#associatedtype.Future" title="type actix_service::ServiceFactory::Future">Future</a>: 'static,
|
||||||
|
SF::<a class="associatedtype" href="../trait.ServiceFactory.html#associatedtype.Error" title="type actix_service::ServiceFactory::Error">Error</a>: 'static,
|
||||||
|
SF::<a class="associatedtype" href="../trait.ServiceFactory.html#associatedtype.InitError" title="type actix_service::ServiceFactory::InitError">InitError</a>: 'static,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Wraps a service factory that returns service trait objects.</p>
|
||||||
|
</div></details></section></div></main></body></html>
|
5
actix_service/boxed/fn.rc_service.html
Normal file
5
actix_service/boxed/fn.rc_service.html
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<!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="Wraps service as a trait object using `RcService`."><title>rc_service in actix_service::boxed - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_service" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_service/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_service/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_service/index.html">actix_<wbr>service</a><span class="version">2.0.2</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In actix_<wbr>service::<wbr>boxed</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_service</a>::<wbr><a href="index.html">boxed</a></span><h1>Function <span class="fn">rc_service</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/actix_service/boxed.rs.html#35">source</a> </span></div><pre class="rust item-decl"><code>pub fn rc_service<S, Req>(service: S) -> <a class="type" href="type.RcService.html" title="type actix_service::boxed::RcService">RcService</a><Req, S::<a class="associatedtype" href="../trait.Service.html#associatedtype.Response" title="type actix_service::Service::Response">Response</a>, S::<a class="associatedtype" href="../trait.Service.html#associatedtype.Error" title="type actix_service::Service::Error">Error</a>><div class="where">where
|
||||||
|
S: <a class="trait" href="../trait.Service.html" title="trait actix_service::Service">Service</a><Req> + 'static,
|
||||||
|
Req: 'static,
|
||||||
|
S::<a class="associatedtype" href="../trait.Service.html#associatedtype.Future" title="type actix_service::Service::Future">Future</a>: 'static,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Wraps service as a trait object using <a href="type.RcService.html" title="type actix_service::boxed::RcService"><code>RcService</code></a>.</p>
|
||||||
|
</div></details></section></div></main></body></html>
|
5
actix_service/boxed/fn.service.html
Normal file
5
actix_service/boxed/fn.service.html
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<!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="Wraps service as a trait object using `BoxService`."><title>service in actix_service::boxed - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_service" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_service/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_service/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_service/index.html">actix_<wbr>service</a><span class="version">2.0.2</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In actix_<wbr>service::<wbr>boxed</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_service</a>::<wbr><a href="index.html">boxed</a></span><h1>Function <span class="fn">service</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/actix_service/boxed.rs.html#34">source</a> </span></div><pre class="rust item-decl"><code>pub fn service<S, Req>(service: S) -> <a class="type" href="type.BoxService.html" title="type actix_service::boxed::BoxService">BoxService</a><Req, S::<a class="associatedtype" href="../trait.Service.html#associatedtype.Response" title="type actix_service::Service::Response">Response</a>, S::<a class="associatedtype" href="../trait.Service.html#associatedtype.Error" title="type actix_service::Service::Error">Error</a>><div class="where">where
|
||||||
|
S: <a class="trait" href="../trait.Service.html" title="trait actix_service::Service">Service</a><Req> + 'static,
|
||||||
|
Req: 'static,
|
||||||
|
S::<a class="associatedtype" href="../trait.Service.html#associatedtype.Future" title="type actix_service::Service::Future">Future</a>: 'static,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Wraps service as a trait object using <a href="type.BoxService.html" title="type actix_service::boxed::BoxService"><code>BoxService</code></a>.</p>
|
||||||
|
</div></details></section></div></main></body></html>
|
2
actix_service/boxed/index.html
Normal file
2
actix_service/boxed/index.html
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<!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="Trait object forms of services and service factories."><title>actix_service::boxed - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_service" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod"><!--[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" title="show sidebar"></button><a class="logo-container" href="../../actix_service/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_service/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_service/index.html">actix_<wbr>service</a><span class="version">2.0.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module boxed</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate actix_<wbr>service</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_service</a></span><h1>Module <span>boxed</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/actix_service/boxed.rs.html#1-138">source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait object forms of services and service factories.</p>
|
||||||
|
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.BoxServiceFactory.html" title="struct actix_service::boxed::BoxServiceFactory">BoxService<wbr>Factory</a></div><div class="desc docblock-short">Wrapper for a service factory that will map it’s services to boxed trait object services.</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.factory.html" title="fn actix_service::boxed::factory">factory</a></div><div class="desc docblock-short">Wraps a service factory that returns service trait objects.</div></li><li><div class="item-name"><a class="fn" href="fn.rc_service.html" title="fn actix_service::boxed::rc_service">rc_<wbr>service</a></div><div class="desc docblock-short">Wraps service as a trait object using <a href="type.RcService.html" title="type actix_service::boxed::RcService"><code>RcService</code></a>.</div></li><li><div class="item-name"><a class="fn" href="fn.service.html" title="fn actix_service::boxed::service">service</a></div><div class="desc docblock-short">Wraps service as a trait object using <a href="type.BoxService.html" title="type actix_service::boxed::BoxService"><code>BoxService</code></a>.</div></li></ul><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="type" href="type.BoxFuture.html" title="type actix_service::boxed::BoxFuture">BoxFuture</a></div><div class="desc docblock-short">A boxed future with no send bound or lifetime parameters.</div></li><li><div class="item-name"><a class="type" href="type.BoxService.html" title="type actix_service::boxed::BoxService">BoxService</a></div><div class="desc docblock-short">Type alias for service trait object using <code>Box</code>.</div></li><li><div class="item-name"><a class="type" href="type.RcService.html" title="type actix_service::boxed::RcService">RcService</a></div><div class="desc docblock-short">Type alias for service trait object using <code>Rc</code>.</div></li></ul></section></div></main></body></html>
|
1
actix_service/boxed/sidebar-items.js
Normal file
1
actix_service/boxed/sidebar-items.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
window.SIDEBAR_ITEMS = {"fn":["factory","rc_service","service"],"struct":["BoxServiceFactory"],"type":["BoxFuture","BoxService","RcService"]};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user