52 lines
11 KiB
HTML
52 lines
11 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="RON is a simple config format which looks similar to Rust syntax."><meta name="keywords" content="rust, rustlang, rust-lang, ron"><title>ron - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><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="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="../crates.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../ron/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../ron/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Crate ron</a></h2><div class="sidebar-elems"><div class="block"><ul><li class="version">Version 0.7.1</li><li><a id="all-types" href="all.html">All Items</a></li></ul></div><section><div class="block"><ul><li><a href="#reexports">Re-exports</a></li><li><a href="#modules">Modules</a></li></ul></div></section></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../ron/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Crate <a class="mod" href="#">ron</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/ron/lib.rs.html#1-78">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>RON is a simple config format which looks similar to Rust syntax.</p>
|
||
<h3 id="features"><a href="#features">Features</a></h3>
|
||
<ul>
|
||
<li>Data types
|
||
<ul>
|
||
<li>Structs, typename optional</li>
|
||
<li>Tuples</li>
|
||
<li>Enums</li>
|
||
<li>Lists</li>
|
||
<li>Maps</li>
|
||
<li>Units (<code>()</code>)</li>
|
||
<li>Optionals</li>
|
||
<li>Primitives: booleans, numbers, string, char</li>
|
||
</ul>
|
||
</li>
|
||
<li>Allows nested layout (similar to JSON)</li>
|
||
<li>Supports comments</li>
|
||
<li>Trailing commas</li>
|
||
<li>Pretty serialization</li>
|
||
</ul>
|
||
<h3 id="syntax-example"><a href="#syntax-example">Syntax example</a></h3>
|
||
<div class='information'><div class='tooltip ignore'>ⓘ</div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore"><code><span class="ident">Game</span>(
|
||
<span class="ident">title</span>: <span class="string">"Hello, RON!"</span>,
|
||
<span class="ident">level</span>: <span class="ident">Level</span>( <span class="comment">// We could just leave the `Level` out</span>
|
||
<span class="ident">buildings</span>: [
|
||
(
|
||
<span class="ident">size</span>: (<span class="number">10</span>, <span class="number">20</span>),
|
||
<span class="ident">color</span>: <span class="ident">Yellow</span>, <span class="comment">// This as an enum variant</span>
|
||
<span class="ident">owner</span>: <span class="prelude-val">None</span>,
|
||
),
|
||
(
|
||
<span class="ident">size</span>: (<span class="number">20</span>, <span class="number">25</span>),
|
||
<span class="ident">color</span>: <span class="ident">Custom</span>(<span class="number">0.1</span>, <span class="number">0.8</span>, <span class="number">1.0</span>),
|
||
<span class="ident">owner</span>: <span class="prelude-val">Some</span>(<span class="string">"guy"</span>),
|
||
),
|
||
],
|
||
<span class="ident">characters</span>: {
|
||
<span class="string">"guy"</span>: (
|
||
<span class="ident">friendly</span>: <span class="bool-val">true</span>,
|
||
),
|
||
},
|
||
),
|
||
)</code></pre></div>
|
||
<h3 id="usage"><a href="#usage">Usage</a></h3>
|
||
<p>Just add it to your <code>Cargo.toml</code>:</p>
|
||
<div class="example-wrap"><pre class="language-toml"><code>[dependencies]
|
||
ron = "*"</code></pre></div>
|
||
<p>Serializing / Deserializing is as simple as calling <code>to_string</code> / <code>from_str</code>.</p>
|
||
<p>!</p>
|
||
</div></details><h2 id="reexports" class="small-section-header"><a href="#reexports">Re-exports</a></h2><div class="item-table"><div class="item-row"><div class="item-left import-item" id="reexport.from_str"><code>pub use de::<a class="fn" href="de/fn.from_str.html" title="fn ron::de::from_str">from_str</a>;</code></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left import-item" id="reexport.Deserializer"><code>pub use de::<a class="struct" href="de/struct.Deserializer.html" title="struct ron::de::Deserializer">Deserializer</a>;</code></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left import-item" id="reexport.Error"><code>pub use error::<a class="struct" href="error/struct.Error.html" title="struct ron::error::Error">Error</a>;</code></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left import-item" id="reexport.ErrorCode"><code>pub use error::<a class="enum" href="error/enum.ErrorCode.html" title="enum ron::error::ErrorCode">ErrorCode</a>;</code></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left import-item" id="reexport.Result"><code>pub use error::<a class="type" href="error/type.Result.html" title="type ron::error::Result">Result</a>;</code></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left import-item" id="reexport.Options"><code>pub use options::<a class="struct" href="options/struct.Options.html" title="struct ron::options::Options">Options</a>;</code></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left import-item" id="reexport.to_string"><code>pub use ser::<a class="fn" href="ser/fn.to_string.html" title="fn ron::ser::to_string">to_string</a>;</code></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left import-item" id="reexport.Serializer"><code>pub use ser::<a class="struct" href="ser/struct.Serializer.html" title="struct ron::ser::Serializer">Serializer</a>;</code></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left import-item" id="reexport.Map"><code>pub use value::<a class="struct" href="value/struct.Map.html" title="struct ron::value::Map">Map</a>;</code></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left import-item" id="reexport.Number"><code>pub use value::<a class="enum" href="value/enum.Number.html" title="enum ron::value::Number">Number</a>;</code></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left import-item" id="reexport.Value"><code>pub use value::<a class="enum" href="value/enum.Value.html" title="enum ron::value::Value">Value</a>;</code></div><div class="item-right docblock-short"></div></div></div><h2 id="modules" class="small-section-header"><a href="#modules">Modules</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="de/index.html" title="ron::de mod">de</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="error/index.html" title="ron::error mod">error</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="extensions/index.html" title="ron::extensions mod">extensions</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="options/index.html" title="ron::options mod">options</a></div><div class="item-right docblock-short"><p>Roundtrip serde Options module.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="ser/index.html" title="ron::ser mod">ser</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="value/index.html" title="ron::value mod">value</a></div><div class="item-right docblock-short"><p>Value module.</p>
|
||
</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="ron" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0 (a55dd71d5 2022-09-19)" ></div></body></html> |