157 lines
No EOL
9.3 KiB
HTML
157 lines
No EOL
9.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 `Serializer` struct in crate `url`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, Serializer">
|
||
|
||
<title>url::form_urlencoded::Serializer - Rust</title>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
|
||
<link rel="stylesheet" type="text/css" href="../../main.css">
|
||
|
||
|
||
|
||
|
||
</head>
|
||
<body class="rustdoc">
|
||
<!--[if lte IE 8]>
|
||
<div class="warning">
|
||
This old browser is unsupported and will most likely display funky
|
||
things.
|
||
</div>
|
||
<![endif]-->
|
||
|
||
|
||
|
||
<nav class="sidebar">
|
||
|
||
<p class='location'><a href='../index.html'>url</a>::<wbr><a href='index.html'>form_urlencoded</a></p><script>window.sidebarCurrent = {name: 'Serializer', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
|
||
</nav>
|
||
|
||
<nav class="sub">
|
||
<form class="search-form js-only">
|
||
<div class="search-container">
|
||
<input class="search-input" name="search"
|
||
autocomplete="off"
|
||
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
||
type="search">
|
||
</div>
|
||
</form>
|
||
</nav>
|
||
|
||
<section id='main' class="content struct">
|
||
<h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>url</a>::<wbr><a href='index.html'>form_urlencoded</a>::<wbr><a class='struct' href=''>Serializer</a></span><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 id='src-1338' class='srclink' href='../../src/url/form_urlencoded.rs.html#210-214' title='goto source code'>[src]</a></span></h1>
|
||
<pre class='rust struct'>pub struct Serializer<T: <a class='trait' href='../../url/form_urlencoded/trait.Target.html' title='url::form_urlencoded::Target'>Target</a>> {
|
||
// some fields omitted
|
||
}</pre><div class='docblock'><p>The <a href="https://url.spec.whatwg.org/#concept-urlencoded-serializer"><code>application/x-www-form-urlencoded</code> serializer</a>.</p>
|
||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl<T: <a class='trait' href='../../url/form_urlencoded/trait.Target.html' title='url::form_urlencoded::Target'>Target</a>> <a class='struct' href='../../url/form_urlencoded/struct.Serializer.html' title='url::form_urlencoded::Serializer'>Serializer</a><T></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-1369' class='srclink' href='../../src/url/form_urlencoded.rs.html#250-346' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.new' class='method'><code>fn <a href='#method.new' class='fnname'>new</a>(target: T) -> Self</code></h4>
|
||
<div class='docblock'><p>Create a new <code>application/x-www-form-urlencoded</code> serializer for the given target.</p>
|
||
|
||
<p>If the target is non-empty,
|
||
its content is assumed to already be in <code>application/x-www-form-urlencoded</code> syntax.</p>
|
||
</div><h4 id='method.for_suffix' class='method'><code>fn <a href='#method.for_suffix' class='fnname'>for_suffix</a>(target: T, start_position: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.usize.html'>usize</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Create a new <code>application/x-www-form-urlencoded</code> serializer
|
||
for a suffix of the given target.</p>
|
||
|
||
<p>If that suffix is non-empty,
|
||
its content is assumed to already be in <code>application/x-www-form-urlencoded</code> syntax.</p>
|
||
</div><h4 id='method.clear' class='method'><code>fn <a href='#method.clear' class='fnname'>clear</a>(&mut self) -> &mut Self</code></h4>
|
||
<div class='docblock'><p>Remove any existing name/value pair.</p>
|
||
|
||
<p>Panics if called after <code>.finish()</code>.</p>
|
||
</div><h4 id='method.append_pair' class='method'><code>fn <a href='#method.append_pair' class='fnname'>append_pair</a>(&mut self, name: &<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>, value: &<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> &mut Self</code></h4>
|
||
<div class='docblock'><p>Serialize and append a name/value pair.</p>
|
||
|
||
<p>Panics if called after <code>.finish()</code>.</p>
|
||
</div><h4 id='method.extend_pairs' class='method'><code>fn <a href='#method.extend_pairs' class='fnname'>extend_pairs</a><I, K, V>(&mut self, iter: I) -> &mut Self <span class='where'>where I: <a class='trait' href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html' title='core::iter::traits::IntoIterator'>IntoIterator</a>, I::Item: <a class='trait' href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html' title='core::borrow::Borrow'>Borrow</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(</a>K, V<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>)</a>>, K: <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html' title='core::convert::AsRef'>AsRef</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>, V: <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html' title='core::convert::AsRef'>AsRef</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>></span></code></h4>
|
||
<div class='docblock'><p>Serialize and append a number of name/value pairs.</p>
|
||
|
||
<p>This simply calls <code>append_pair</code> repeatedly.
|
||
This can be more convenient, so the user doesn’t need to introduce a block
|
||
to limit the scope of <code>Serializer</code>’s borrow of its string.</p>
|
||
|
||
<p>Panics if called after <code>.finish()</code>.</p>
|
||
</div><h4 id='method.finish' class='method'><code>fn <a href='#method.finish' class='fnname'>finish</a>(&mut self) -> T::Finished</code></h4>
|
||
<div class='docblock'><p>If this serializer was constructed with a string, take and return that string.</p>
|
||
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>use</span> <span class='ident'>url</span>::<span class='ident'>form_urlencoded</span>;
|
||
<span class='kw'>let</span> <span class='ident'>encoded</span>: <span class='ident'>String</span> <span class='op'>=</span> <span class='ident'>form_urlencoded</span>::<span class='ident'>Serializer</span>::<span class='ident'>new</span>(<span class='ident'>String</span>::<span class='ident'>new</span>())
|
||
.<span class='ident'>append_pair</span>(<span class='string'>"foo"</span>, <span class='string'>"bar & baz"</span>)
|
||
.<span class='ident'>append_pair</span>(<span class='string'>"saison"</span>, <span class='string'>"Été+hiver"</span>)
|
||
.<span class='ident'>finish</span>();
|
||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>encoded</span>, <span class='string'>"foo=bar+%26+baz&saison=%C3%89t%C3%A9%2Bhiver"</span>);</pre>
|
||
|
||
<p>Panics if called more than once.</p>
|
||
</div></div></section>
|
||
<section id='search' class="content hidden"></section>
|
||
|
||
<section class="footer"></section>
|
||
|
||
<aside id="help" class="hidden">
|
||
<div>
|
||
<h1 class="hidden">Help</h1>
|
||
|
||
<div class="shortcuts">
|
||
<h2>Keyboard Shortcuts</h2>
|
||
|
||
<dl>
|
||
<dt>?</dt>
|
||
<dd>Show this help dialog</dd>
|
||
<dt>S</dt>
|
||
<dd>Focus the search field</dd>
|
||
<dt>⇤</dt>
|
||
<dd>Move up in search results</dd>
|
||
<dt>⇥</dt>
|
||
<dd>Move down in search results</dd>
|
||
<dt>⏎</dt>
|
||
<dd>Go to active search result</dd>
|
||
<dt>+</dt>
|
||
<dd>Collapse/expand all sections</dd>
|
||
</dl>
|
||
</div>
|
||
|
||
<div class="infos">
|
||
<h2>Search Tricks</h2>
|
||
|
||
<p>
|
||
Prefix searches with a type followed by a colon (e.g.
|
||
<code>fn:</code>) to restrict the search to a given type.
|
||
</p>
|
||
|
||
<p>
|
||
Accepted types are: <code>fn</code>, <code>mod</code>,
|
||
<code>struct</code>, <code>enum</code>,
|
||
<code>trait</code>, <code>type</code>, <code>macro</code>,
|
||
and <code>const</code>.
|
||
</p>
|
||
|
||
<p>
|
||
Search functions by type signature (e.g.
|
||
<code>vec -> usize</code> or <code>* -> vec</code>)
|
||
</p>
|
||
</div>
|
||
</div>
|
||
</aside>
|
||
|
||
|
||
|
||
<script>
|
||
window.rootPath = "../../";
|
||
window.currentCrate = "url";
|
||
window.playgroundUrl = "";
|
||
</script>
|
||
<script src="../../jquery.js"></script>
|
||
<script src="../../main.js"></script>
|
||
|
||
<script defer src="../../search-index.js"></script>
|
||
</body>
|
||
</html> |