44 lines
7.3 KiB
HTML
44 lines
7.3 KiB
HTML
<!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="API documentation for the Rust `actix_web_codegen` crate."><meta name="keywords" content="rust, rustlang, rust-lang, actix_web_codegen"><title>actix_web_codegen - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../actix_web_codegen/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Crate actix_web_codegen</p><div class="sidebar-elems"><a id='all-types' href='all.html'><p>See all actix_web_codegen's items</p></a><p class='location'></p><script>window.sidebarCurrent = {name: 'actix_web_codegen', ty: 'mod', relpath: '../'};</script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/actix_web_codegen/lib.rs.html#1-186' title='goto source code'>[src]</a></span><span class='in-band'>Crate <a class="mod" href=''>actix_web_codegen</a></span></h1><div class='docblock'><p>Actix-web codegen module</p>
|
||
<p>Generators for routes and scopes</p>
|
||
<h2 id="route" class="section-header"><a href="#route">Route</a></h2>
|
||
<p>Macros:</p>
|
||
<ul>
|
||
<li><a href="attr.get.html">get</a></li>
|
||
<li><a href="attr.post.html">post</a></li>
|
||
<li><a href="attr.put.html">put</a></li>
|
||
<li><a href="attr.delete.html">delete</a></li>
|
||
<li><a href="attr.head.html">head</a></li>
|
||
<li><a href="attr.connect.html">connect</a></li>
|
||
<li><a href="attr.options.html">options</a></li>
|
||
<li><a href="attr.trace.html">trace</a></li>
|
||
<li><a href="attr.patch.html">patch</a></li>
|
||
</ul>
|
||
<h3 id="attributes" class="section-header"><a href="#attributes">Attributes:</a></h3>
|
||
<ul>
|
||
<li><code>"path"</code> - Raw literal string with path for which to register handle. Mandatory.</li>
|
||
<li><code>guard="function_name"</code> - Registers function as guard using <code>actix_web::guard::fn_guard</code></li>
|
||
</ul>
|
||
<h2 id="notes" class="section-header"><a href="#notes">Notes</a></h2>
|
||
<p>Function name can be specified as any expression that is going to be accessible to the generate
|
||
code (e.g <code>my_guard</code> or <code>my_module::my_guard</code>)</p>
|
||
<h2 id="example" class="section-header"><a href="#example">Example:</a></h2>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">actix_web</span>::<span class="ident">HttpResponse</span>;
|
||
<span class="kw">use</span> <span class="ident">actix_web_codegen</span>::<span class="ident">get</span>;
|
||
<span class="kw">use</span> <span class="ident">futures</span>::{<span class="ident">future</span>, <span class="ident">Future</span>};
|
||
|
||
<span class="attribute">#[<span class="ident">get</span>(<span class="string">"/test"</span>)]</span>
|
||
<span class="kw">fn</span> <span class="ident">async_test</span>() <span class="op">-</span><span class="op">></span> <span class="kw">impl</span> <span class="ident">Future</span><span class="op"><</span><span class="ident">Item</span><span class="op">=</span><span class="ident">HttpResponse</span>, <span class="ident">Error</span><span class="op">=</span><span class="ident">actix_web</span>::<span class="ident">Error</span><span class="op">></span> {
|
||
<span class="ident">future</span>::<span class="ident">ok</span>(<span class="ident">HttpResponse</span>::<span class="prelude-val">Ok</span>().<span class="ident">finish</span>())
|
||
}</pre></div>
|
||
</div><h2 id='attributes-1' class='section-header'><a href="#attributes-1">Attribute Macros</a></h2>
|
||
<table><tr class='module-item'><td><a class="attr" href="attr.connect.html" title='actix_web_codegen::connect attr'>connect</a></td><td class='docblock-short'><p>Creates route handler with <code>CONNECT</code> method guard.</p>
|
||
</td></tr><tr class='module-item'><td><a class="attr" href="attr.delete.html" title='actix_web_codegen::delete attr'>delete</a></td><td class='docblock-short'><p>Creates route handler with <code>DELETE</code> method guard.</p>
|
||
</td></tr><tr class='module-item'><td><a class="attr" href="attr.get.html" title='actix_web_codegen::get attr'>get</a></td><td class='docblock-short'><p>Creates route handler with <code>GET</code> method guard.</p>
|
||
</td></tr><tr class='module-item'><td><a class="attr" href="attr.head.html" title='actix_web_codegen::head attr'>head</a></td><td class='docblock-short'><p>Creates route handler with <code>HEAD</code> method guard.</p>
|
||
</td></tr><tr class='module-item'><td><a class="attr" href="attr.options.html" title='actix_web_codegen::options attr'>options</a></td><td class='docblock-short'><p>Creates route handler with <code>OPTIONS</code> method guard.</p>
|
||
</td></tr><tr class='module-item'><td><a class="attr" href="attr.patch.html" title='actix_web_codegen::patch attr'>patch</a></td><td class='docblock-short'><p>Creates route handler with <code>PATCH</code> method guard.</p>
|
||
</td></tr><tr class='module-item'><td><a class="attr" href="attr.post.html" title='actix_web_codegen::post attr'>post</a></td><td class='docblock-short'><p>Creates route handler with <code>POST</code> method guard.</p>
|
||
</td></tr><tr class='module-item'><td><a class="attr" href="attr.put.html" title='actix_web_codegen::put attr'>put</a></td><td class='docblock-short'><p>Creates route handler with <code>PUT</code> method guard.</p>
|
||
</td></tr><tr class='module-item'><td><a class="attr" href="attr.trace.html" title='actix_web_codegen::trace attr'>trace</a></td><td class='docblock-short'><p>Creates route handler with <code>TRACE</code> method guard.</p>
|
||
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "actix_web_codegen";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |