You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Trac3r-rust/doc/rustc_serialize/trait.Encoder.html

361 lines
140 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!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 `Encoder` trait in crate `rustc_serialize`."><meta name="keywords" content="rust, rustlang, rust-lang, Encoder"><title>rustc_serialize::Encoder - 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="https://www.rust-lang.org/favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[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">&#9776;</div><a href='../rustc_serialize/index.html'><div class='logo-container'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='logo'></div></a><p class='location'>Trait Encoder</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#associated-types">Associated Types</a><div class="sidebar-links"><a href="#associatedtype.Error">Error</a></div><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.emit_bool">emit_bool</a><a href="#tymethod.emit_char">emit_char</a><a href="#tymethod.emit_enum">emit_enum</a><a href="#tymethod.emit_enum_struct_variant">emit_enum_struct_variant</a><a href="#tymethod.emit_enum_struct_variant_field">emit_enum_struct_variant_field</a><a href="#tymethod.emit_enum_variant">emit_enum_variant</a><a href="#tymethod.emit_enum_variant_arg">emit_enum_variant_arg</a><a href="#tymethod.emit_f32">emit_f32</a><a href="#tymethod.emit_f64">emit_f64</a><a href="#tymethod.emit_i16">emit_i16</a><a href="#tymethod.emit_i32">emit_i32</a><a href="#tymethod.emit_i64">emit_i64</a><a href="#tymethod.emit_i8">emit_i8</a><a href="#tymethod.emit_isize">emit_isize</a><a href="#tymethod.emit_map">emit_map</a><a href="#tymethod.emit_map_elt_key">emit_map_elt_key</a><a href="#tymethod.emit_map_elt_val">emit_map_elt_val</a><a href="#tymethod.emit_nil">emit_nil</a><a href="#tymethod.emit_option">emit_option</a><a href="#tymethod.emit_option_none">emit_option_none</a><a href="#tymethod.emit_option_some">emit_option_some</a><a href="#tymethod.emit_seq">emit_seq</a><a href="#tymethod.emit_seq_elt">emit_seq_elt</a><a href="#tymethod.emit_str">emit_str</a><a href="#tymethod.emit_struct">emit_struct</a><a href="#tymethod.emit_struct_field">emit_struct_field</a><a href="#tymethod.emit_tuple">emit_tuple</a><a href="#tymethod.emit_tuple_arg">emit_tuple_arg</a><a href="#tymethod.emit_tuple_struct">emit_tuple_struct</a><a href="#tymethod.emit_tuple_struct_arg">emit_tuple_struct_arg</a><a href="#tymethod.emit_u16">emit_u16</a><a href="#tymethod.emit_u32">emit_u32</a><a href="#tymethod.emit_u64">emit_u64</a><a href="#tymethod.emit_u8">emit_u8</a><a href="#tymethod.emit_usize">emit_usize</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='index.html'>rustc_serialize</a></p><script>window.sidebarCurrent = {name: 'Encoder', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></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 js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" 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'>&#x2212;</span>]</a></span><a class='srclink' href='../src/rustc_serialize/serialize.rs.html#47-489' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='index.html'>rustc_serialize</a>::<wbr><a class="trait" href=''>Encoder</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait Encoder {
type <a href='#associatedtype.Error' class="type">Error</a>;
fn <a href='#tymethod.emit_nil' class='fnname'>emit_nil</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_usize' class='fnname'>emit_usize</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_u64' class='fnname'>emit_u64</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_u32' class='fnname'>emit_u32</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_u16' class='fnname'>emit_u16</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_u8' class='fnname'>emit_u8</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_isize' class='fnname'>emit_isize</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_i64' class='fnname'>emit_i64</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_i32' class='fnname'>emit_i32</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_i16' class='fnname'>emit_i16</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_i8' class='fnname'>emit_i8</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_bool' class='fnname'>emit_bool</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_f64' class='fnname'>emit_f64</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_f32' class='fnname'>emit_f32</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_char' class='fnname'>emit_char</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.char.html">char</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_str' class='fnname'>emit_str</a>(&amp;mut self, v: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_enum' class='fnname'>emit_enum</a>&lt;F&gt;(&amp;mut self, name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_enum_variant' class='fnname'>emit_enum_variant</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v_name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v_id: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_enum_variant_arg' class='fnname'>emit_enum_variant_arg</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a_idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_enum_struct_variant' class='fnname'>emit_enum_struct_variant</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v_name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v_id: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_enum_struct_variant_field' class='fnname'>emit_enum_struct_variant_field</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f_name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f_idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_struct' class='fnname'>emit_struct</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_struct_field' class='fnname'>emit_struct_field</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f_name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f_idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_tuple' class='fnname'>emit_tuple</a>&lt;F&gt;(&amp;mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_tuple_arg' class='fnname'>emit_tuple_arg</a>&lt;F&gt;(&amp;mut self, idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_tuple_struct' class='fnname'>emit_tuple_struct</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_tuple_struct_arg' class='fnname'>emit_tuple_struct_arg</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f_idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_option' class='fnname'>emit_option</a>&lt;F&gt;(&amp;mut self, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_option_none' class='fnname'>emit_option_none</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_option_some' class='fnname'>emit_option_some</a>&lt;F&gt;(&amp;mut self, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_seq' class='fnname'>emit_seq</a>&lt;F&gt;(&amp;mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_seq_elt' class='fnname'>emit_seq_elt</a>&lt;F&gt;(&amp;mut self, idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_map' class='fnname'>emit_map</a>&lt;F&gt;(&amp;mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_map_elt_key' class='fnname'>emit_map_elt_key</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
<div class='item-spacer'></div> fn <a href='#tymethod.emit_map_elt_val' class='fnname'>emit_map_elt_val</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</span>;
}</pre></div><div class='docblock'><p>Trait for writing out an encoding when serializing.</p>
<p>This trait provides methods to encode basic types and generic forms of
collections. Implementations of <code>Encodable</code> use it to perform the actual
encoding of a type.</p>
<p>It is unspecified what is done with the encoding - it could be stored in a
variable, or written directly to a file, for example.</p>
<p>Encoders can expect to only have a single &quot;root&quot; method call made on this
trait. Non-trivial types will call one of the collection-emitting methods,
passing a function that may call other methods on the trait, but once the
collection-emitting method has returned, encoding should be complete.</p>
</div>
<h2 id='associated-types' class='small-section-header'>Associated Types<a href='#associated-types' class='anchor'></a></h2><div class='methods'><h3 id='associatedtype.Error' class='method'><code id='Error.t'>type <a href='#associatedtype.Error' class="type">Error</a></code></h3><div class='docblock'><p>The error type for method results.</p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.emit_nil' class='method'><code id='emit_nil.v'>fn <a href='#tymethod.emit_nil' class='fnname'>emit_nil</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a nil value.</p>
<p>For example, this might be stored as the null keyword in JSON.</p>
</div><h3 id='tymethod.emit_usize' class='method'><code id='emit_usize.v'>fn <a href='#tymethod.emit_usize' class='fnname'>emit_usize</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a usize value.</p>
</div><h3 id='tymethod.emit_u64' class='method'><code id='emit_u64.v'>fn <a href='#tymethod.emit_u64' class='fnname'>emit_u64</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a u64 value.</p>
</div><h3 id='tymethod.emit_u32' class='method'><code id='emit_u32.v'>fn <a href='#tymethod.emit_u32' class='fnname'>emit_u32</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a u32 value.</p>
</div><h3 id='tymethod.emit_u16' class='method'><code id='emit_u16.v'>fn <a href='#tymethod.emit_u16' class='fnname'>emit_u16</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a u16 value.</p>
</div><h3 id='tymethod.emit_u8' class='method'><code id='emit_u8.v'>fn <a href='#tymethod.emit_u8' class='fnname'>emit_u8</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a u8 value.</p>
</div><h3 id='tymethod.emit_isize' class='method'><code id='emit_isize.v'>fn <a href='#tymethod.emit_isize' class='fnname'>emit_isize</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a isize value.</p>
</div><h3 id='tymethod.emit_i64' class='method'><code id='emit_i64.v'>fn <a href='#tymethod.emit_i64' class='fnname'>emit_i64</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a i64 value.</p>
</div><h3 id='tymethod.emit_i32' class='method'><code id='emit_i32.v'>fn <a href='#tymethod.emit_i32' class='fnname'>emit_i32</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a i32 value.</p>
</div><h3 id='tymethod.emit_i16' class='method'><code id='emit_i16.v'>fn <a href='#tymethod.emit_i16' class='fnname'>emit_i16</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a i16 value.</p>
</div><h3 id='tymethod.emit_i8' class='method'><code id='emit_i8.v'>fn <a href='#tymethod.emit_i8' class='fnname'>emit_i8</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a i8 value.</p>
</div><h3 id='tymethod.emit_bool' class='method'><code id='emit_bool.v'>fn <a href='#tymethod.emit_bool' class='fnname'>emit_bool</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a bool value.</p>
<p>For example, this might be stored as the true and false keywords in
JSON.</p>
</div><h3 id='tymethod.emit_f64' class='method'><code id='emit_f64.v'>fn <a href='#tymethod.emit_f64' class='fnname'>emit_f64</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a f64 value.</p>
</div><h3 id='tymethod.emit_f32' class='method'><code id='emit_f32.v'>fn <a href='#tymethod.emit_f32' class='fnname'>emit_f32</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a f32 value.</p>
</div><h3 id='tymethod.emit_char' class='method'><code id='emit_char.v'>fn <a href='#tymethod.emit_char' class='fnname'>emit_char</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.char.html">char</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a char value.</p>
<p>Note that strings should be emitted using <code>emit_str</code>, not as a sequence
of <code>emit_char</code> calls.</p>
</div><h3 id='tymethod.emit_str' class='method'><code id='emit_str.v'>fn <a href='#tymethod.emit_str' class='fnname'>emit_str</a>(&amp;mut self, v: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit a string value.</p>
</div><h3 id='tymethod.emit_enum' class='method'><code id='emit_enum.v'>fn <a href='#tymethod.emit_enum' class='fnname'>emit_enum</a>&lt;F&gt;(&amp;mut self, name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit an enumeration value.</p>
<ul>
<li><code>name</code> indicates the enumeration type name.</li>
<li><code>f</code> is a function that will call <code>emit_enum_variant</code> or
<code>emit_enum_struct_variant</code> as appropriate to write the actual value.</li>
</ul>
</div><h3 id='tymethod.emit_enum_variant' class='method'><code id='emit_enum_variant.v'>fn <a href='#tymethod.emit_enum_variant' class='fnname'>emit_enum_variant</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;v_name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;v_id: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit a enumeration variant value with no or unnamed data.</p>
<p>This should only be called from a function passed to <code>emit_enum</code>.
Variants with named data should use <code>emit_enum_struct_variant</code>.</p>
<ul>
<li><code>v_name</code> is the variant name</li>
<li><code>v_id</code> is the numeric identifier for the variant.</li>
<li><code>len</code> is the number of data items associated with the variant.</li>
<li><code>f</code> is a function that will call <code>emit_enum_variant_arg</code> for each data
item. It may not be called if len is 0.</li>
</ul>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">rustc_serialize</span>::<span class="ident">Encodable</span>;
<span class="kw">use</span> <span class="ident">rustc_serialize</span>::<span class="ident">Encoder</span>;
<span class="kw">enum</span> <span class="ident">Message</span> {
<span class="ident">Quit</span>,
<span class="ident">ChangeColor</span>(<span class="ident">i32</span>, <span class="ident">i32</span>, <span class="ident">i32</span>),
}
<span class="kw">impl</span> <span class="ident">Encodable</span> <span class="kw">for</span> <span class="ident">Message</span> {
<span class="kw">fn</span> <span class="ident">encode</span><span class="op">&lt;</span><span class="ident">S</span>: <span class="ident">Encoder</span><span class="op">&gt;</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">s</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">S</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>(), <span class="ident">S</span>::<span class="ident">Error</span><span class="op">&gt;</span> {
<span class="ident">s</span>.<span class="ident">emit_enum</span>(<span class="string">&quot;Message&quot;</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="kw">match</span> <span class="kw-2">*</span><span class="self">self</span> {
<span class="ident">Message</span>::<span class="ident">Quit</span> <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">s</span>.<span class="ident">emit_enum_variant</span>(<span class="string">&quot;Quit&quot;</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> <span class="prelude-val">Ok</span>(()))
}
<span class="ident">Message</span>::<span class="ident">ChangeColor</span>(<span class="ident">r</span>, <span class="ident">g</span>, <span class="ident">b</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">s</span>.<span class="ident">emit_enum_variant</span>(<span class="string">&quot;ChangeColor&quot;</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="macro">try</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">emit_enum_variant_arg</span>(<span class="number">0</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="ident">s</span>.<span class="ident">emit_i32</span>(<span class="ident">r</span>)
}));
<span class="macro">try</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">emit_enum_variant_arg</span>(<span class="number">1</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="ident">s</span>.<span class="ident">emit_i32</span>(<span class="ident">g</span>)
}));
<span class="macro">try</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">emit_enum_variant_arg</span>(<span class="number">2</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="ident">s</span>.<span class="ident">emit_i32</span>(<span class="ident">b</span>)
}));
<span class="prelude-val">Ok</span>(())
})
}
}
})
}
}</pre></div>
</div><h3 id='tymethod.emit_enum_variant_arg' class='method'><code id='emit_enum_variant_arg.v'>fn <a href='#tymethod.emit_enum_variant_arg' class='fnname'>emit_enum_variant_arg</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;a_idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit an unnamed data item for an enumeration variant.</p>
<p>This should only be called from a function passed to
<code>emit_enum_variant</code>.</p>
<ul>
<li><code>a_idx</code> is the (zero-based) index of the data item.</li>
<li><code>f</code> is a function that will call the appropriate emit method to encode
the data object.</li>
</ul>
<p>Note that variant data items must be emitted in order - starting with
index <code>0</code> and finishing with index <code>len-1</code>.</p>
</div><h3 id='tymethod.emit_enum_struct_variant' class='method'><code id='emit_enum_struct_variant.v'>fn <a href='#tymethod.emit_enum_struct_variant' class='fnname'>emit_enum_struct_variant</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;v_name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;v_id: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit a enumeration variant value with no or named data.</p>
<p>This should only be called from a function passed to <code>emit_enum</code>.
Variants with unnamed data should use <code>emit_enum_variant</code>.</p>
<ul>
<li><code>v_name</code> is the variant name.</li>
<li><code>v_id</code> is the numeric identifier for the variant.</li>
<li><code>len</code> is the number of data items associated with the variant.</li>
<li><code>f</code> is a function that will call <code>emit_enum_struct_variant_field</code> for
each data item. It may not be called if <code>len</code> is <code>0</code>.</li>
</ul>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">rustc_serialize</span>::<span class="ident">Encodable</span>;
<span class="kw">use</span> <span class="ident">rustc_serialize</span>::<span class="ident">Encoder</span>;
<span class="kw">enum</span> <span class="ident">Message</span> {
<span class="ident">Quit</span>,
<span class="ident">Move</span> { <span class="ident">x</span>: <span class="ident">i32</span>, <span class="ident">y</span>: <span class="ident">i32</span> },
}
<span class="kw">impl</span> <span class="ident">Encodable</span> <span class="kw">for</span> <span class="ident">Message</span> {
<span class="kw">fn</span> <span class="ident">encode</span><span class="op">&lt;</span><span class="ident">S</span>: <span class="ident">Encoder</span><span class="op">&gt;</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">s</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">S</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>(), <span class="ident">S</span>::<span class="ident">Error</span><span class="op">&gt;</span> {
<span class="ident">s</span>.<span class="ident">emit_enum</span>(<span class="string">&quot;Message&quot;</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="kw">match</span> <span class="kw-2">*</span><span class="self">self</span> {
<span class="ident">Message</span>::<span class="ident">Quit</span> <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">s</span>.<span class="ident">emit_enum_struct_variant</span>(<span class="string">&quot;Quit&quot;</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> <span class="prelude-val">Ok</span>(()))
}
<span class="ident">Message</span>::<span class="ident">Move</span> { <span class="ident">x</span>: <span class="ident">x</span>, <span class="ident">y</span>: <span class="ident">y</span> } <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">s</span>.<span class="ident">emit_enum_struct_variant</span>(<span class="string">&quot;Move&quot;</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="macro">try</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">emit_enum_struct_variant_field</span>(<span class="string">&quot;x&quot;</span>, <span class="number">0</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="ident">s</span>.<span class="ident">emit_i32</span>(<span class="ident">x</span>)
}));
<span class="macro">try</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">emit_enum_struct_variant_field</span>(<span class="string">&quot;y&quot;</span>, <span class="number">1</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="ident">s</span>.<span class="ident">emit_i32</span>(<span class="ident">y</span>)
}));
<span class="prelude-val">Ok</span>(())
})
}
}
})
}
}</pre></div>
</div><h3 id='tymethod.emit_enum_struct_variant_field' class='method'><code id='emit_enum_struct_variant_field.v'>fn <a href='#tymethod.emit_enum_struct_variant_field' class='fnname'>emit_enum_struct_variant_field</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;f_name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f_idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit a named data item for an enumeration variant.</p>
<p>This should only be called from a function passed to
<code>emit_enum_struct_variant</code>.</p>
<ul>
<li><code>f_name</code> is the name of the data item field.</li>
<li><code>f_idx</code> is its (zero-based) index.</li>
<li><code>f</code> is a function that will call the appropriate emit method to encode
the data object.</li>
</ul>
<p>Note that fields must be emitted in order - starting with index <code>0</code> and
finishing with index <code>len-1</code>.</p>
</div><h3 id='tymethod.emit_struct' class='method'><code id='emit_struct.v'>fn <a href='#tymethod.emit_struct' class='fnname'>emit_struct</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit a struct value.</p>
<ul>
<li><code>name</code> is the name of the struct.</li>
<li><code>len</code> is the number of members.</li>
<li><code>f</code> is a function that calls <code>emit_struct_field</code> for each member.</li>
</ul>
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">rustc_serialize</span>::<span class="ident">Encodable</span>;
<span class="kw">use</span> <span class="ident">rustc_serialize</span>::<span class="ident">Encoder</span>;
<span class="kw">struct</span> <span class="ident">Point</span> {
<span class="ident">x</span>: <span class="ident">i32</span>,
<span class="ident">y</span>: <span class="ident">i32</span>,
}
<span class="kw">impl</span> <span class="ident">Encodable</span> <span class="kw">for</span> <span class="ident">Point</span> {
<span class="kw">fn</span> <span class="ident">encode</span><span class="op">&lt;</span><span class="ident">S</span>: <span class="ident">Encoder</span><span class="op">&gt;</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">s</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">S</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>(), <span class="ident">S</span>::<span class="ident">Error</span><span class="op">&gt;</span> {
<span class="ident">s</span>.<span class="ident">emit_struct</span>(<span class="string">&quot;Point&quot;</span>, <span class="number">2</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="macro">try</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">emit_struct_field</span>(<span class="string">&quot;x&quot;</span>, <span class="number">0</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="ident">s</span>.<span class="ident">emit_i32</span>(<span class="self">self</span>.<span class="ident">x</span>)
}));
<span class="macro">try</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">emit_struct_field</span>(<span class="string">&quot;y&quot;</span>, <span class="number">1</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="ident">s</span>.<span class="ident">emit_i32</span>(<span class="self">self</span>.<span class="ident">y</span>)
}));
<span class="prelude-val">Ok</span>(())
})
}
}</pre></div>
</div><h3 id='tymethod.emit_struct_field' class='method'><code id='emit_struct_field.v'>fn <a href='#tymethod.emit_struct_field' class='fnname'>emit_struct_field</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;f_name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f_idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit a field item for a struct.</p>
<p>This should only be called from a function passed to <code>emit_struct</code>.</p>
<ul>
<li><code>f_name</code> is the name of the data item field.</li>
<li><code>f_idx</code> is its (zero-based) index.</li>
<li><code>f</code> is a function that will call the appropriate emit method to encode
the data object.</li>
</ul>
<p>Note that fields must be emitted in order - starting with index <code>0</code> and
finishing with index <code>len-1</code>.</p>
</div><h3 id='tymethod.emit_tuple' class='method'><code id='emit_tuple.v'>fn <a href='#tymethod.emit_tuple' class='fnname'>emit_tuple</a>&lt;F&gt;(&amp;mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit a tuple value.</p>
<ul>
<li><code>len</code> is the number of items in the tuple.</li>
<li><code>f</code> is a function that calls <code>emit_tuple_arg</code> for each member.</li>
</ul>
<p>Note that external <code>Encodable</code> implementations should not normally need
to use this method directly; it is meant for the use of this module's
own implementation of <code>Encodable</code> for tuples.</p>
</div><h3 id='tymethod.emit_tuple_arg' class='method'><code id='emit_tuple_arg.v'>fn <a href='#tymethod.emit_tuple_arg' class='fnname'>emit_tuple_arg</a>&lt;F&gt;(&amp;mut self, idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit a data item for a tuple.</p>
<p>This should only be called from a function passed to <code>emit_tuple</code>.</p>
<ul>
<li><code>idx</code> is the (zero-based) index of the data item.</li>
<li><code>f</code> is a function that will call the appropriate emit method to encode
the data object.</li>
</ul>
<p>Note that tuple items must be emitted in order - starting with index <code>0</code>
and finishing with index <code>len-1</code>.</p>
</div><h3 id='tymethod.emit_tuple_struct' class='method'><code id='emit_tuple_struct.v'>fn <a href='#tymethod.emit_tuple_struct' class='fnname'>emit_tuple_struct</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit a tuple struct value.</p>
<ul>
<li><code>name</code> is the name of the tuple struct.</li>
<li><code>len</code> is the number of items in the tuple struct.</li>
<li><code>f</code> is a function that calls <code>emit_tuple_struct_arg</code> for each member.</li>
</ul>
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">rustc_serialize</span>::<span class="ident">Encodable</span>;
<span class="kw">use</span> <span class="ident">rustc_serialize</span>::<span class="ident">Encoder</span>;
<span class="kw">struct</span> <span class="ident">Pair</span>(<span class="ident">i32</span>,<span class="ident">i32</span>);
<span class="kw">impl</span> <span class="ident">Encodable</span> <span class="kw">for</span> <span class="ident">Pair</span> {
<span class="kw">fn</span> <span class="ident">encode</span><span class="op">&lt;</span><span class="ident">S</span>: <span class="ident">Encoder</span><span class="op">&gt;</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">s</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">S</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>(), <span class="ident">S</span>::<span class="ident">Error</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">Pair</span>(<span class="ident">first</span>,<span class="ident">second</span>) <span class="op">=</span> <span class="kw-2">*</span><span class="self">self</span>;
<span class="ident">s</span>.<span class="ident">emit_tuple_struct</span>(<span class="string">&quot;Pair&quot;</span>, <span class="number">2</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="macro">try</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">emit_tuple_arg</span>(<span class="number">0</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="ident">s</span>.<span class="ident">emit_i32</span>(<span class="ident">first</span>)
}));
<span class="macro">try</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">emit_tuple_arg</span>(<span class="number">1</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="ident">s</span>.<span class="ident">emit_i32</span>(<span class="ident">second</span>)
}));
<span class="prelude-val">Ok</span>(())
})
}
}</pre></div>
</div><h3 id='tymethod.emit_tuple_struct_arg' class='method'><code id='emit_tuple_struct_arg.v'>fn <a href='#tymethod.emit_tuple_struct_arg' class='fnname'>emit_tuple_struct_arg</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;f_idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit a data item for a tuple struct.</p>
<p>This should only be called from a function passed to
<code>emit_tuple_struct</code>.</p>
<ul>
<li><code>f_idx</code> is the (zero-based) index of the data item.</li>
<li><code>f</code> is a function that will call the appropriate emit method to encode
the data object.</li>
</ul>
<p>Note that tuple items must be emitted in order - starting with index <code>0</code>
and finishing with index <code>len-1</code>.</p>
</div><h3 id='tymethod.emit_option' class='method'><code id='emit_option.v'>fn <a href='#tymethod.emit_option' class='fnname'>emit_option</a>&lt;F&gt;(&amp;mut self, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit an optional value.</p>
<p><code>f</code> is a function that will call either <code>emit_option_none</code> or
<code>emit_option_some</code> as appropriate.</p>
<p>This method allows encoders to handle <code>Option&lt;T&gt;</code> values specially,
rather than using the generic enum methods, because many encoding
formats have a built-in &quot;optional&quot; concept.</p>
<p>Note that external <code>Encodable</code> implementations should not normally need
to use this method directly; it is meant for the use of this module's
own implementation of <code>Encodable</code> for <code>Option&lt;T&gt;</code>.</p>
</div><h3 id='tymethod.emit_option_none' class='method'><code id='emit_option_none.v'>fn <a href='#tymethod.emit_option_none' class='fnname'>emit_option_none</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;</code></h3><div class='docblock'><p>Emit the <code>None</code> optional value.</p>
<p>This should only be called from a function passed to <code>emit_option</code>.</p>
</div><h3 id='tymethod.emit_option_some' class='method'><code id='emit_option_some.v'>fn <a href='#tymethod.emit_option_some' class='fnname'>emit_option_some</a>&lt;F&gt;(&amp;mut self, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit the <code>Some(x)</code> optional value.</p>
<p><code>f</code> is a function that will call the appropriate emit method to encode
the data object.</p>
<p>This should only be called from a function passed to <code>emit_option</code>.</p>
</div><h3 id='tymethod.emit_seq' class='method'><code id='emit_seq.v'>fn <a href='#tymethod.emit_seq' class='fnname'>emit_seq</a>&lt;F&gt;(&amp;mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit a sequence of values.</p>
<p>This should be used for both array-like ordered sequences and set-like
unordered ones.</p>
<ul>
<li><code>len</code> is the number of values in the sequence.</li>
<li><code>f</code> is a function that will call <code>emit_seq_elt</code> for each value in the
sequence.</li>
</ul>
</div><h3 id='tymethod.emit_seq_elt' class='method'><code id='emit_seq_elt.v'>fn <a href='#tymethod.emit_seq_elt' class='fnname'>emit_seq_elt</a>&lt;F&gt;(&amp;mut self, idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit an element in a sequence.</p>
<p>This should only be called from a function passed to <code>emit_seq</code>.</p>
<ul>
<li><code>idx</code> is the (zero-based) index of the value in the sequence.</li>
<li><code>f</code> is a function that will call the appropriate emit method to encode
the data object.</li>
</ul>
<p>Note that sequence elements must be emitted in order - starting with
index <code>0</code> and finishing with index <code>len-1</code>.</p>
</div><h3 id='tymethod.emit_map' class='method'><code id='emit_map.v'>fn <a href='#tymethod.emit_map' class='fnname'>emit_map</a>&lt;F&gt;(&amp;mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit an associative container (map).</p>
<ul>
<li><code>len</code> is the number of entries in the map.</li>
<li><code>f</code> is a function that will call <code>emit_map_elt_key</code> and
<code>emit_map_elt_val</code> for each entry in the map.</li>
</ul>
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">rustc_serialize</span>::<span class="ident">Encodable</span>;
<span class="kw">use</span> <span class="ident">rustc_serialize</span>::<span class="ident">Encoder</span>;
<span class="kw">struct</span> <span class="ident">SimpleMap</span><span class="op">&lt;</span><span class="ident">K</span>,<span class="ident">V</span><span class="op">&gt;</span> {
<span class="ident">entries</span>: <span class="ident">Vec</span><span class="op">&lt;</span>(<span class="ident">K</span>,<span class="ident">V</span>)<span class="op">&gt;</span>,
}
<span class="kw">impl</span><span class="op">&lt;</span><span class="ident">K</span>:<span class="ident">Encodable</span>,<span class="ident">V</span>:<span class="ident">Encodable</span><span class="op">&gt;</span> <span class="ident">Encodable</span> <span class="kw">for</span> <span class="ident">SimpleMap</span><span class="op">&lt;</span><span class="ident">K</span>,<span class="ident">V</span><span class="op">&gt;</span> {
<span class="kw">fn</span> <span class="ident">encode</span><span class="op">&lt;</span><span class="ident">S</span>: <span class="ident">Encoder</span><span class="op">&gt;</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">s</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">S</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>(), <span class="ident">S</span>::<span class="ident">Error</span><span class="op">&gt;</span> {
<span class="ident">s</span>.<span class="ident">emit_map</span>(<span class="self">self</span>.<span class="ident">entries</span>.<span class="ident">len</span>(), <span class="op">|</span><span class="ident">s</span><span class="op">|</span> {
<span class="kw">for</span> (<span class="ident">i</span>, <span class="ident">e</span>) <span class="kw">in</span> <span class="self">self</span>.<span class="ident">entries</span>.<span class="ident">iter</span>().<span class="ident">enumerate</span>() {
<span class="kw">let</span> (<span class="kw-2">ref</span> <span class="ident">k</span>, <span class="kw-2">ref</span> <span class="ident">v</span>) <span class="op">=</span> <span class="kw-2">*</span><span class="ident">e</span>;
<span class="macro">try</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">emit_map_elt_key</span>(<span class="ident">i</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> <span class="ident">k</span>.<span class="ident">encode</span>(<span class="ident">s</span>)));
<span class="macro">try</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">emit_map_elt_val</span>(<span class="ident">i</span>, <span class="op">|</span><span class="ident">s</span><span class="op">|</span> <span class="ident">v</span>.<span class="ident">encode</span>(<span class="ident">s</span>)));
}
<span class="prelude-val">Ok</span>(())
})
}
}</pre></div>
</div><h3 id='tymethod.emit_map_elt_key' class='method'><code id='emit_map_elt_key.v'>fn <a href='#tymethod.emit_map_elt_key' class='fnname'>emit_map_elt_key</a>&lt;F&gt;(&amp;mut self, idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit the key for an entry in a map.</p>
<p>This should only be called from a function passed to <code>emit_map</code>.</p>
<ul>
<li><code>idx</code> is the (zero-based) index of the entry in the map</li>
<li><code>f</code> is a function that will call the appropriate emit method to encode
the key.</li>
</ul>
<p>Note that map entries must be emitted in order - starting with index <code>0</code>
and finishing with index <code>len-1</code> - and for each entry, the key should be
emitted followed immediately by the value.</p>
</div><h3 id='tymethod.emit_map_elt_val' class='method'><code id='emit_map_elt_val.v'>fn <a href='#tymethod.emit_map_elt_val' class='fnname'>emit_map_elt_val</a>&lt;F&gt;(&amp;mut self, idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../rustc_serialize/trait.Encoder.html#associatedtype.Error" title="type rustc_serialize::Encoder::Error">Error</a>&gt;,&nbsp;</span></code></h3><div class='docblock'><p>Emit the value for an entry in a map.</p>
<p>This should only be called from a function passed to <code>emit_map</code>.</p>
<ul>
<li><code>idx</code> is the (zero-based) index of the entry in the map</li>
<li><code>f</code> is a function that will call the appropriate emit method to encode
the value.</li>
</ul>
<p>Note that map entries must be emitted in order - starting with index <code>0</code>
and finishing with index <code>len-1</code> - and for each entry, the key should be
emitted followed immediately by the value.</p>
</div></div><span class='loading-content'>Loading content...</span>
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-Encoder' class='impl'><code class='in-band'>impl&lt;'a&gt; Encoder for <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;</code><a href='#impl-Encoder' class='anchor'></a><a class='srclink' href='../src/rustc_serialize/json.rs.html#622-928' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='#associatedtype.Error-1' class="type">Error</a> = <a class="enum" href="../rustc_serialize/json/enum.EncoderError.html" title="enum rustc_serialize::json::EncoderError">EncoderError</a></code></h4><h4 id='method.emit_nil' class="method hidden"><code id='emit_nil.v-1'>fn <a href='#method.emit_nil' class='fnname'>emit_nil</a>(&amp;mut self) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#625-629' title='goto source code'>[src]</a></h4><h4 id='method.emit_usize' class="method hidden"><code id='emit_usize.v-1'>fn <a href='#method.emit_usize' class='fnname'>emit_usize</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#631' title='goto source code'>[src]</a></h4><h4 id='method.emit_u64' class="method hidden"><code id='emit_u64.v-1'>fn <a href='#method.emit_u64' class='fnname'>emit_u64</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#632' title='goto source code'>[src]</a></h4><h4 id='method.emit_u32' class="method hidden"><code id='emit_u32.v-1'>fn <a href='#method.emit_u32' class='fnname'>emit_u32</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#633' title='goto source code'>[src]</a></h4><h4 id='method.emit_u16' class="method hidden"><code id='emit_u16.v-1'>fn <a href='#method.emit_u16' class='fnname'>emit_u16</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#634' title='goto source code'>[src]</a></h4><h4 id='method.emit_u8' class="method hidden"><code id='emit_u8.v-1'>fn <a href='#method.emit_u8' class='fnname'>emit_u8</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#635' title='goto source code'>[src]</a></h4><h4 id='method.emit_isize' class="method hidden"><code id='emit_isize.v-1'>fn <a href='#method.emit_isize' class='fnname'>emit_isize</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#637' title='goto source code'>[src]</a></h4><h4 id='method.emit_i64' class="method hidden"><code id='emit_i64.v-1'>fn <a href='#method.emit_i64' class='fnname'>emit_i64</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#638' title='goto source code'>[src]</a></h4><h4 id='method.emit_i32' class="method hidden"><code id='emit_i32.v-1'>fn <a href='#method.emit_i32' class='fnname'>emit_i32</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#639' title='goto source code'>[src]</a></h4><h4 id='method.emit_i16' class="method hidden"><code id='emit_i16.v-1'>fn <a href='#method.emit_i16' class='fnname'>emit_i16</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#640' title='goto source code'>[src]</a></h4><h4 id='method.emit_i8' class="method hidden"><code id='emit_i8.v-1'>fn <a href='#method.emit_i8' class='fnname'>emit_i8</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#641' title='goto source code'>[src]</a></h4><h4 id='method.emit_bool' class="method hidden"><code id='emit_bool.v-1'>fn <a href='#method.emit_bool' class='fnname'>emit_bool</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#643-651' title='goto source code'>[src]</a></h4><h4 id='method.emit_f64' class="method hidden"><code id='emit_f64.v-1'>fn <a href='#method.emit_f64' class='fnname'>emit_f64</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#653-655' title='goto source code'>[src]</a></h4><h4 id='method.emit_f32' class="method hidden"><code id='emit_f32.v-1'>fn <a href='#method.emit_f32' class='fnname'>emit_f32</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#656-658' title='goto source code'>[src]</a></h4><h4 id='method.emit_char' class="method hidden"><code id='emit_char.v-1'>fn <a href='#method.emit_char' class='fnname'>emit_char</a>(&amp;mut self, v: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.char.html">char</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#660-662' title='goto source code'>[src]</a></h4><h4 id='method.emit_str' class="method hidden"><code id='emit_str.v-1'>fn <a href='#method.emit_str' class='fnname'>emit_str</a>(&amp;mut self, v: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#663-665' title='goto source code'>[src]</a></h4><h4 id='method.emit_enum' class="method hidden"><code id='emit_enum.v-1'>fn <a href='#method.emit_enum' class='fnname'>emit_enum</a>&lt;F&gt;(&amp;mut self, _name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, f: F) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#667-671' title='goto source code'>[src]</a></h4><h4 id='method.emit_enum_variant' class="method hidden"><code id='emit_enum_variant.v-1'>fn <a href='#method.emit_enum_variant' class='fnname'>emit_enum_variant</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;_id: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;cnt: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#673-717' title='goto source code'>[src]</a></h4><h4 id='method.emit_enum_variant_arg' class="method hidden"><code id='emit_enum_variant_arg.v-1'>fn <a href='#method.emit_enum_variant_arg' class='fnname'>emit_enum_variant_arg</a>&lt;F&gt;(&amp;mut self, idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#719-733' title='goto source code'>[src]</a></h4><h4 id='method.emit_enum_struct_variant' class="method hidden"><code id='emit_enum_struct_variant.v-1'>fn <a href='#method.emit_enum_struct_variant' class='fnname'>emit_enum_struct_variant</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;id: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;cnt: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#735-744' title='goto source code'>[src]</a></h4><h4 id='method.emit_enum_struct_variant_field' class="method hidden"><code id='emit_enum_struct_variant_field.v-1'>fn <a href='#method.emit_enum_struct_variant_field' class='fnname'>emit_enum_struct_variant_field</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;_: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#746-754' title='goto source code'>[src]</a></h4><h4 id='method.emit_struct' class="method hidden"><code id='emit_struct.v-1'>fn <a href='#method.emit_struct' class='fnname'>emit_struct</a>&lt;F&gt;(&amp;mut self, _: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#757-777' title='goto source code'>[src]</a></h4><h4 id='method.emit_struct_field' class="method hidden"><code id='emit_struct_field.v-1'>fn <a href='#method.emit_struct_field' class='fnname'>emit_struct_field</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;name: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#779-797' title='goto source code'>[src]</a></h4><h4 id='method.emit_tuple' class="method hidden"><code id='emit_tuple.v-1'>fn <a href='#method.emit_tuple' class='fnname'>emit_tuple</a>&lt;F&gt;(&amp;mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#799-804' title='goto source code'>[src]</a></h4><h4 id='method.emit_tuple_arg' class="method hidden"><code id='emit_tuple_arg.v-1'>fn <a href='#method.emit_tuple_arg' class='fnname'>emit_tuple_arg</a>&lt;F&gt;(&amp;mut self, idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#805-810' title='goto source code'>[src]</a></h4><h4 id='method.emit_tuple_struct' class="method hidden"><code id='emit_tuple_struct.v-1'>fn <a href='#method.emit_tuple_struct' class='fnname'>emit_tuple_struct</a>&lt;F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;_: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#812-817' title='goto source code'>[src]</a></h4><h4 id='method.emit_tuple_struct_arg' class="method hidden"><code id='emit_tuple_struct_arg.v-1'>fn <a href='#method.emit_tuple_struct_arg' class='fnname'>emit_tuple_struct_arg</a>&lt;F&gt;(&amp;mut self, idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#818-823' title='goto source code'>[src]</a></h4><h4 id='method.emit_option' class="method hidden"><code id='emit_option.v-1'>fn <a href='#method.emit_option' class='fnname'>emit_option</a>&lt;F&gt;(&amp;mut self, f: F) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#825-830' title='goto source code'>[src]</a></h4><h4 id='method.emit_option_none' class="method hidden"><code id='emit_option_none.v-1'>fn <a href='#method.emit_option_none' class='fnname'>emit_option_none</a>(&amp;mut self) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/rustc_serialize/json.rs.html#831-834' title='goto source code'>[src]</a></h4><h4 id='method.emit_option_some' class="method hidden"><code id='emit_option_some.v-1'>fn <a href='#method.emit_option_some' class='fnname'>emit_option_some</a>&lt;F&gt;(&amp;mut self, f: F) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#835-840' title='goto source code'>[src]</a></h4><h4 id='method.emit_seq' class="method hidden"><code id='emit_seq.v-1'>fn <a href='#method.emit_seq' class='fnname'>emit_seq</a>&lt;F&gt;(&amp;mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#842-862' title='goto source code'>[src]</a></h4><h4 id='method.emit_seq_elt' class="method hidden"><code id='emit_seq_elt.v-1'>fn <a href='#method.emit_seq_elt' class='fnname'>emit_seq_elt</a>&lt;F&gt;(&amp;mut self, idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#864-876' title='goto source code'>[src]</a></h4><h4 id='method.emit_map' class="method hidden"><code id='emit_map.v-1'>fn <a href='#method.emit_map' class='fnname'>emit_map</a>&lt;F&gt;(&amp;mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#878-898' title='goto source code'>[src]</a></h4><h4 id='method.emit_map_elt_key' class="method hidden"><code id='emit_map_elt_key.v-1'>fn <a href='#method.emit_map_elt_key' class='fnname'>emit_map_elt_key</a>&lt;F&gt;(&amp;mut self, idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#900-915' title='goto source code'>[src]</a></h4><h4 id='method.emit_map_elt_val' class="method hidden"><code id='emit_map_elt_val.v-1'>fn <a href='#method.emit_map_elt_val' class='fnname'>emit_map_elt_val</a>&lt;F&gt;(&amp;mut self, _idx: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, f: F) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>(&amp;mut <a class="struct" href="../rustc_serialize/json/struct.Encoder.html" title="struct rustc_serialize::json::Encoder">Encoder</a>&lt;'a&gt;) -&gt; <a class="type" href="../rustc_serialize/json/type.EncodeResult.html" title="type rustc_serialize::json::EncodeResult">EncodeResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,&nbsp;</span></code><a class='srclink' href='../src/rustc_serialize/json.rs.html#917-927' title='goto source code'>[src]</a></h4></div></div><span class='loading-content'>Loading content...</span><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
src="../implementors/rustc_serialize/trait.Encoder.js">
</script></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><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse 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><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "rustc_serialize";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>