pnmixer-rust/serde/index.html
2017-07-15 01:30:16 +02:00

219 lines
11 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 `serde` crate.">
<meta name="keywords" content="rust, rustlang, rust-lang, serde">
<title>serde - Rust</title>
<link rel="stylesheet" type="text/css" href="../normalize.css">
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../main.css">
</head>
<body class="rustdoc mod">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'>Crate serde</p><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#macros">Macros</a></li><li><a href="#traits">Traits</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'serde', ty: 'mod', relpath: '../'};</script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Crate <a class="mod" href=''>serde</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../src/serde/lib.rs.html#9-260' title='goto source code'>[src]</a></span></h1>
<div class='docblock'>
<h1 id='serde' class='section-header'><a href='#serde'>Serde</a></h1>
<p>Serde is a framework for <strong><em>ser</em></strong>ializing and <strong><em>de</em></strong>serializing Rust data
structures efficiently and generically.</p>
<p>The Serde ecosystem consists of data structures that know how to serialize
and deserialize themselves along with data formats that know how to
serialize and deserialize other things. Serde provides the layer by which
these two groups interact with each other, allowing any supported data
structure to be serialized and deserialized using any supported data format.</p>
<p>See the Serde website <a href="https://serde.rs/">https://serde.rs/</a> for additional documentation and
usage examples.</p>
<h2 id='design' class='section-header'><a href='#design'>Design</a></h2>
<p>Where many other languages rely on runtime reflection for serializing data,
Serde is instead built on Rust&#39;s powerful trait system. A data structure
that knows how to serialize and deserialize itself is one that implements
Serde&#39;s <code>Serialize</code> and <code>Deserialize</code> traits (or uses Serde&#39;s derive
attribute to automatically generate implementations at compile time). This
avoids any overhead of reflection or runtime type information. In fact in
many situations the interaction between data structure and data format can
be completely optimized away by the Rust compiler, leaving Serde
serialization to perform the same speed as a handwritten serializer for the
specific selection of data structure and data format.</p>
<h2 id='data-formats' class='section-header'><a href='#data-formats'>Data formats</a></h2>
<p>The following is a partial list of data formats that have been implemented
for Serde by the community.</p>
<ul>
<li><a href="https://github.com/serde-rs/json">JSON</a>, the ubiquitous JavaScript Object Notation used by many HTTP APIs.</li>
<li><a href="https://github.com/TyOverby/bincode">Bincode</a>, a compact binary format
used for IPC within the Servo rendering engine.</li>
<li><a href="https://github.com/pyfisch/cbor">CBOR</a>, a Concise Binary Object Representation designed for small message
size without the need for version negotiation.</li>
<li><a href="https://github.com/dtolnay/serde-yaml">YAML</a>, a popular human-friendly configuration language that ain&#39;t markup
language.</li>
<li><a href="https://github.com/3Hren/msgpack-rust">MessagePack</a>, an efficient binary format that resembles a compact JSON.</li>
<li><a href="https://github.com/alexcrichton/toml-rs">TOML</a>, a minimal configuration format used by <a href="http://doc.crates.io/manifest.html">Cargo</a>.</li>
<li><a href="https://github.com/birkenfeld/serde-pickle">Pickle</a>, a format common in the Python world.</li>
<li><a href="https://github.com/laktak/hjson-rust">Hjson</a>, a variant of JSON designed to be readable and writable by humans.</li>
<li><a href="https://github.com/zonyitoo/bson-rs">BSON</a>, the data storage and network transfer format used by MongoDB.</li>
<li><a href="https://github.com/nox/serde_urlencoded">URL</a>, the x-www-form-urlencoded format.</li>
<li><a href="https://github.com/RReverser/serde-xml-rs">XML</a>, the flexible machine-friendly W3C standard.
<em>(deserialization only)</em></li>
<li><a href="https://github.com/softprops/envy">Envy</a>, a way to deserialize environment variables into Rust structs.
<em>(deserialization only)</em></li>
<li><a href="https://github.com/OneSignal/serde-redis">Redis</a>, deserialize values from Redis when using <a href="https://crates.io/crates/redis">redis-rs</a>.
<em>(deserialization only)</em></li>
</ul>
</div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
<table>
<tr class=' module-item'>
<td><a class="mod" href="de/index.html"
title='mod serde::de'>de</a></td>
<td class='docblock-short'>
<p>Generic data structure deserialization framework.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="mod" href="ser/index.html"
title='mod serde::ser'>ser</a></td>
<td class='docblock-short'>
<p>Generic data structure serialization framework.</p>
</td>
</tr></table><h2 id='macros' class='section-header'><a href="#macros">Macros</a></h2>
<table>
<tr class=' module-item'>
<td><a class="macro" href="macro.forward_to_deserialize_any.html"
title='macro serde::forward_to_deserialize_any'>forward_to_deserialize_any</a></td>
<td class='docblock-short'>
<p>Helper macro when implementing the <code>Deserializer</code> part of a new data format
for Serde.</p>
</td>
</tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
<table>
<tr class=' module-item'>
<td><a class="trait" href="trait.Deserialize.html"
title='trait serde::Deserialize'>Deserialize</a></td>
<td class='docblock-short'>
<p>A <strong>data structure</strong> that can be deserialized from any data format supported
by Serde.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="trait" href="trait.Deserializer.html"
title='trait serde::Deserializer'>Deserializer</a></td>
<td class='docblock-short'>
<p>A <strong>data format</strong> that can deserialize any data structure supported by
Serde.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="trait" href="trait.Serialize.html"
title='trait serde::Serialize'>Serialize</a></td>
<td class='docblock-short'>
<p>A <strong>data structure</strong> that can be serialized into any data format supported
by Serde.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="trait" href="trait.Serializer.html"
title='trait serde::Serializer'>Serializer</a></td>
<td class='docblock-short'>
<p>A <strong>data format</strong> that can serialize any data structure supported by Serde.</p>
</td>
</tr></table></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../";
window.currentCrate = "serde";
</script>
<script src="../main.js"></script>
<script defer src="../search-index.js"></script>
</body>
</html>